Extensionless URL trailing slash redirect

后端 未结 1 1559
生来不讨喜
生来不讨喜 2021-01-03 13:32

I\'ve tested the code below on several domains hosted on Dreamhost and it works—except on newer domains I\'ve added within the last year.

RewriteEngine on

         


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

    You are redirecting to $1 in both cases, and you don't have a RewriteBase directive to tell Apache where to root such a relative path.

    Try adding a root slash before the $1 to anchor it to the root of your webserver, for instance:

    RewriteRule ^(.*)$ /$1.php [L]
    
    0 讨论(0)
提交回复
热议问题