Jump to content

trailing slash help


dipp02

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.