htaccess Redirect directory name to parameter

前端 未结 2 421
天涯浪人
天涯浪人 2020-12-20 13:25

I would like to redirect all paths like this:

myurl.com/worldwide/en
myurl.com/worldwide/pt
myurl.com/worldwide/de

to:

myur         


        
相关标签:
2条回答
  • 2020-12-20 13:59

    Use this code

    RewriteEngine On
    RewriteBase /worldwide/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?lang=$1 [L,QSA]
    

    Please let me know if this helps you

    0 讨论(0)
  • 2020-12-20 14:04
    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule ^ %{REQUEST_URI}.php [L,NC]
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME}.php !-f
    RewriteRule ^(.+)$ /index.php?page=$1 [L,QSA]
    
    0 讨论(0)
提交回复
热议问题