简体   繁体   中英

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=

at present my htaccess file /.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

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..

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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