简体   繁体   English

想要从htaccess重定向子目录

[英]want to redirect subdirectory from htaccess

example.com/watch.php?id=1995/english-videos <- this url i want to redirect like this -> www.example.com/watch/1995/english-videos

i want to redirect only watch.php and i want to get value after id= 我只想重定向watch.php并且我想在id=之后获取价值

at present my htaccess file /.htaccess 目前我的htaccess文件/.htaccess

RewriteEngine on

RewriteCond %{HTTP_HOST} ^col3negmovie.com$
RewriteRule ^(.*)$ "http\:\/\/www\.col3negmovie\.com\/$1" [R=301,L]

if can someone help me for do this one... thanks. 如果有人可以帮助我做到这一点...谢谢。 and i want to 301 Redirect 我想301重定向

example.com/watch.php?id= 1995/english-videos <- want to get this value and redirect to this url www.example.com/watch/1995/english-videos like this.. example.com/watch.php?id= 1995/english-videos <-想要获取此值并重定向到该网址,例如www.example.com/watch/1995/english-videos

You can use: 您可以使用:

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]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM