Vanity URLs without trailing slashes on Apache

后端 未结 4 614
天命终不由人
天命终不由人 2021-01-21 18:13

The code below rewrites all URLs in the /profiles/ directory on our site from example.com/profiles/name/ to example.com/name/, but we\'d also like to r

4条回答
  •  一个人的身影
    2021-01-21 18:58

    You need to disable directory slash

    Try :

    DirectorySlash Off
    
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /profiles/$1 [NC,L]
    

提交回复
热议问题