Hi,
Ive been trying to remove the trailing slashes of my urls with mod_rewrite, but cant do it!
with the code below it would force:
site.com/folder/folder/ to site.com/folder/folder
and site.com/folder/folder/folder/ to site.com/folder/folder/folder (i think!?)
but site.com/folder threw a 500 error.
What needs to be added/changed to make it force www and removal of trailing slashes???
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.site\.com$ [NC]
RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]
# Was only using code above. but added this which worked, but not entirely.
#RewriteRule ^(.+)/$ /$1 [R=301, L]
#Then i have multiple parts like the one below to redirect
############### SCHOOL LISTINGS ###############
RewriteRule ^irish-dance-schools/([0-9\_\-]+)/([a-zA-Z\_\-]+)$ irish-dance-schools/listing.php?school_id=$1 [L]
RewriteRule ^irish-dance-schools/([a-zA-Z\_\-]+)$ irish-dance-schools/regions.php?country=$1 [L]
RewriteRule ^irish-dance-schools/([a-zA-Z\_\-]+)/page/([0-9\_\-]+)$ irish-dance-schools/regions.php?country=$1&page=$2 [L]
RewriteRule ^irish-dance-schools/([a-zA-Z\_\-]+)/([a-zA-Z\_\-]+)/page/([0-9\_\-]+)$ irish-dance-schools/regions.php?region=$2&page=$3 [L]
RewriteRule ^irish-dance-schools/([a-zA-Z\_\-]+)/([a-zA-Z\_\-]+)$ irish-dance-schools/regions.php?region=$2 [L]
Thank you in advance for your help and suggestions!
Danny 🙂