Mod_Rewrite with Relative Path Redirects

前端 未结 1 664
无人及你
无人及你 2021-01-13 05:22

I have this rule in an .htaccess file located in a directory named clips/:

RewriteRule ^mlk/?$ segment/index.php?clip=1 [R=301,QSA,L]

相关标签:
1条回答
  • 2021-01-13 06:03

    Try adding a RewriteBase directive as below

    RewriteEngine On
    RewriteBase /clips/
    
    RewriteRule ^mlk/?$ segment/index.php?clip=1 [R=301,QSA,L]
    

    EDIT

    but is there any way to get this to work without using a RewriteBase directive

    You could also try

    RewriteEngine On
    
    
    RewriteCond %{REQUEST_URI} ^(/[^/]+/) [NC] 
    RewriteRule ^mlk/?$ http://%{HTTP_HOST}%1segment/index.php?clip=1 [R=301,QSA,L]
    
    0 讨论(0)
提交回复
热议问题