0

I want to add / slash after words that are not start with html index.php

for example :

www.domain.com/test  --->  www.domain.com/test/
www.domain.com/index.php?test --> Not change
www.domain.com/test/test  --> Notchange

I know how to add slash with htaccess but I cant figure out how to not add it at the end of url's start with index.php or have two /(url's like domain.com/test/test)

uchar
  • 2,552
  • 4
  • 29
  • 50
  • My htaccess : http://stackoverflow.com/questions/23033857/how-to-change-url-structure-with-301-code-q2a – uchar Apr 13 '14 at 18:43

1 Answers1

1

You can use this rule:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.(html|php)$ [NC]
RewriteRule ^[^/]+/?$ %{REQUEST_URI}/ [L,R=301]
anubhava
  • 761,203
  • 64
  • 569
  • 643