【问题标题】:want to redirect subdirectory from htaccess想要从 htaccess 重定向子目录
【发布时间】:2014-04-13 03:08:45
【问题描述】:
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 www.example.com/watch/1995/english-videos 像这样..

【问题讨论】:

    标签: regex apache .htaccess mod-rewrite redirect


    【解决方案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]
    

    【讨论】:

    • @anubhava 请原谅我有一个awk question...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-19
    • 1970-01-01
    • 1970-01-01
    • 2015-10-08
    • 1970-01-01
    • 1970-01-01
    • 2013-07-12
    相关资源
    最近更新 更多