Welcome to WebmasterWorld Guest from

Forum Moderators: phranque

Message Too Old, No Replies

htaccess and Friendly URL

having a bit of a complication

1:57 am on Dec 6, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 7, 2007
votes: 0

I have frienyl urls working on my small app. I decided instead of using get for every single parameter request, I would explode the URL string and gather the parameters this way ( so I can access them via $url[3] and so on ).

Problem is, I can visit site.com/somecategory or site.com/somecategory/ with minor differences. Without the trailing slash, certain images break. I want it with only the trailing slash, so if its left out, it needs to automatically be added.

Is there anyways to do this with htaccess? Currently, this is what my htaccess looks like...

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?category=$1/ [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z_]+)/([^/]+) index.php?category=$1&content=$2
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php?category=$1/ [L]

I figured if you can access both, not only will certain things break for the user, but Google would also consider this a duplicate. Any help is much appreciated.