Add Trailing Slash .htaccess

后端 未结 3 665
别那么骄傲
别那么骄傲 2020-11-30 07:21

I\'m trying to get the following effect (using this local file http://localhost/[company_name]/[project_name]/.htaccess):

http://localhost/[comp         


        
相关标签:
3条回答
  • 2020-11-30 07:22
    RewriteCond %{REQUEST_URI} !(/$|\.) 
    RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] 
    
    0 讨论(0)
  • 2020-11-30 07:29

    Please add below lines top of .htaccess file

    RewriteEngine on
    #Add Trailing slash for end of the URL
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*[^/])$ /$1/ [L,R]
    
    0 讨论(0)
  • 2020-11-30 07:29

    Please use this format in .htaccess,

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/ [L,R=301]
    
    0 讨论(0)
提交回复
热议问题