1
我试图和谷歌搜索几个小时了,无法找到我的问题的解决方案。我想重写:htaccess重写规则,没有斜杠
domain.com/profile.php?user=abc> domain.com/abc
我用:
RewriteRule ^(.*)/$ /profile.php?user=$1 [L]
只在末端斜线的作品。如果我没有斜杠尝试它
RewriteRule ^(.*)$ /profile.php?user=$1 [L]
我得到一个内部服务器错误!
完整的.htaccess
ErrorDocument 404 /errors/404.php
ErrorDocument 500 /errors/500.php
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !\.(css|jpg|gif|png|jar|js|html|htm|php)$
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
RewriteRule ^share/([^/]*)/$ /share/share.php?id=$1 [L]
RewriteRule ^(.*)/$ /profile.php?user=$1 [L]
<IfModule mod_deflate.c>
<FilesMatch "\.(html|php|txt|xml|js|css|svg)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE\s7 !no-gzip !gzip-only-text/html
Someboy有一个想法是什么林做错了什么?
感谢, 科内尔
钍为你提供帮助。随着你的方式请求正常工作,但URL被改回'profile.php?user = xxx' –
这很奇怪。很难知道为什么,也许是因为你可能有其他规则?你可以看看http标题,并告诉我当你尝试你的链接时发生了什么? –
嗯非常奇怪,现在它的工作。 有没有办法得到这两个选项,**/**和没有**/**和结束? –