dipp02 Posted September 12, 2008 Share Posted September 12, 2008 hello, i have mod rewrite working great but i just noticed about the trailing slash... i then put this code in at the top of my .htaccess file RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ http://phillyedm.com/$1/ [L,R=301] now when i goto "phillyedm.com/about" it redirects me to "phillyedm.com/about/" which is what i want... but now when i try and goto my blog system which is "phillyedm.com/blog/1" i get a 404 error.... here is my full .htaccess file. RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ http://phillyedm.com/$1/ [L,R=301] RewriteRule ^blog/([^/]*)$ /blog.php?page=$1 [L] RewriteRule ^blog/([^/]*)/([^/]*)/([^/]*)$ /blog.php?page=$1&catid=$2&list=$3 [L] RewriteRule ^article/([^/]*)$ /comments.php?article=$1 [L] RewriteRule ^article/([^/]*)/editCmmt/([^/]*)$ /comments.php?article=$1&editCmmt=$2 [L] RewriteRule ^article/([^/]*)/edit/([^/]*)$ /comments.php?article=$1&edit=$2 [L] RewriteRule ^article/([^/]*)/del/([^/]*)$ /comments.php?article=$1&del=$2 [L] RewriteRule ^article/([^/]*)/del/([^/]*)/yes/([^/]*)$ /comments.php?article=$1&del=$2&yes=$3 [L] RewriteRule ^article/([^/]*)/delCmmt/([^/]*)$ /comments.php?article=$1&delCmmt=$2 [L] RewriteRule ^article/([^/]*)/editCmmt/([^/]*)$ /comments.php?article=$1&editCmmt=$2 [L] RewriteRule ^article/([^/]*)/done/([^/]*)$ /comments.php?article=$1&done=$2 [L] RewriteRule ^article/([^/]*)/delCmmt/([^/]*)/yes/([^/]*)$ /comments.php?article=$1&delCmmt=$2&yes=$3 [L] any ideas on how to get the "blog/1" to work? and also redirect me to "blog/1/" ? i also have some urls with 3 vars like so -> "article/20/edit/20" and would like it to redirect to ... "article/20/edit/20/" any ideas? i have tried this: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !([^/].*)/$ RewriteRule ^([^/].*)$ http://phillyedm.com/$1/$2/$3 [L,R=301] but it then does this -> "phillyedm.com/blog/1//" adds two slashes at the end. thanks a bunch. Link to comment https://forums.phpfreaks.com/topic/123854-trailing-slash-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.