我想将http://example.com/search/search.php?q=videos
重定向到http://example.com/search/videos
我试图这样做,但它不起作用。这里是我的htaccess文件:http://example.com/search/.htaccess
<Files .htaccess>
order allow,deny
</Files>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /search/
RewriteRule ^([^/]+)(?:/[^/]+)?/?$ search.php?q=$1 [L,QSA]
RewriteRule ^([^/]+)/[^/]+/([0-9]+)/?$ search.php?q=$1&p=$2 [L,QSA]
RewriteRule ^search/(.*)$ load.php?q=$1 [L]
上一个RewriteRule
无法正常工作..如何修复..帮助...谢谢RewriteRule ^search/(.*)$ load.php?q=$1 [L]
答案 0 :(得分:1)
在/search/.htaccess
:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /search/
RewriteCond %{THE_REQUEST} /search\.php\?q=([^\s&]+) [NC]
RewriteRule ^ %1? [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/?$ search.php?q=$1 [L,QSA]
RewriteRule ^[^/]+/([0-9]+)/?$ search.php?q=$1&p=$2 [L,QSA]