mod_rewrite not working htaccess

后端 未结 3 903
孤街浪徒
孤街浪徒 2021-01-27 04:21

I have a website with 11 sub-domains.I have one main htaccess file in the public_html root folder that has the common shared traits like cache

3条回答
  •  -上瘾入骨i
    2021-01-27 05:02

    Both Apache and nginx have the concept of internal and external redirects.

    What you could do to accomplish your task is create a "redirect loop", where /days/content.php?day=thur would redirect/R (external redirect) to /thursday, whereas /thursday would internally go back to /days/content.php?day=thur, which may initially look like a loop.

    See:

    • nginx redirect loop, remove index.php from url

    This could be done by testing against the request uri in each case:

    RewriteCond %{REQUEST_URI} ^/days/content.php$
    RewriteCond %{QUERY_STRING} ^day=thur$
    RewriteRule ^(.*)$ /thursday? [R,L] # external redirect
    
    RewriteCond %{REQUEST_URI} ^/thursday$
    RewriteRule ^(.*)$ /days/content.php?day=thur [L] # internal redirect
    

提交回复
热议问题