example.com/watch.php?id=1995/english-videos <- this url i want to redirect like this -> www.example.com/watch/1995/english-videos
我想仅重定向watch.php
,我希望在id=
之后获得价值
目前我的htaccess文件 /.htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^col3negmovie.com$
RewriteRule ^(.*)$ "http\:\/\/www\.col3negmovie\.com\/$1" [R=301,L]
如果有人可以帮我做这个...谢谢。我想301重定向
example.com/watch.php?id = 1995/english-videos
&lt; - 想要获取此值并重定向到此网址www.example.com/watch/1995/english-videos
,就像这样..
答案 0 :(得分:1)
您可以使用:
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^col3negmovie\.com$
RewriteRule ^(.*)$ http://www.col3negmovie.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+watch\.php\?id=([^\s&]+) [NC]
RewriteRule ^ watch/%1? [R=301,L]
RewriteRule ^watch/(.+?)/?$ watch.php?id=$1 [L,QSA,NC]