apache - .htaccess remove trailing slash - should be simple? -


so have following .htaccess file in 1 of folders (public):

<ifmodule mod_rewrite.c>   <ifmodule mod_negotiation.c>     options -multiviews   </ifmodule>    rewriteengine on    # redirect trailing slashes...   rewriterule ^(.*)/$ /$1 [l,r=301] </ifmodule> 

i need http://localhost/eamorr.com/lv/public/about/

to redirect to:

http://localhost/eamorr.com/lv/public/about (i.e. trailing slash removed)

but i'm getting follows:

http://localhost/eamorr.com/lv/public/about/

redirects to:

http://localhost/about

(the trailing slash got removed ok, path wrong!!!)

can apache2 experts suggest anything? find these redirect rules terse understanding.

here's complete .htaccess file (nothing else in file):

<ifmodule mod_rewrite.c>   <ifmodule mod_negotiation.c>     options -multiviews   </ifmodule>    rewriteengine on    directoryslash off    # redirect trailing slashes...   rewriterule ^(.*)/$ /$1 [r=302]   ###rewriterule ^(.*)/$ /$1 [l,r=302]    # handle front controller...   rewritecond %{request_filename} !-d   rewritecond %{request_filename} !-f   rewriterule ^ index.php [l] </ifmodule> 

you might facing mod_dir trickery. try , see if helps.

  directoryslash off   options -indexes   rewriteengine on   # redirect trailing slashes...   rewriterule ^(.*)/$ /$1 [l,r=302] 

change 302 301 when test out , see if working.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -