Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Add trailing slash to URLs via .htaccess?
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Add trailing slash to URLs via .htaccess?
Add trailing slash to URLs via .htaccess?
24-04-2010 1:04 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Hi, I have a blog which is located at:
[tt]http://ccgi.jtonline.plus.com/blog/[/tt]
It is working well with one slight exception; if you use that address to access it, but omit the trailing slash (and there's a link in my RSS feed that does this) it redirects to:
[tt]http://ccgi.jtonline.plus.com/~jtonline/blog/[/tt]
which obviously results in a Page Not Found error.
Is there something within my .htaccess file that I can change/add so that a trailing slash is added to that URL automatically, but that won't break the rest of the site?
Here is my current .htaccess content:
I tried adding some code I found on a website whilst trying to fix this myself, but if I use it I get an Internal Server error 500. Here is what I tried adding:
I can't get my head around the syntax used in htacess files, so any examples of what I should type and where is much appreciated
[tt]http://ccgi.jtonline.plus.com/blog/[/tt]
It is working well with one slight exception; if you use that address to access it, but omit the trailing slash (and there's a link in my RSS feed that does this) it redirects to:
[tt]http://ccgi.jtonline.plus.com/~jtonline/blog/[/tt]
which obviously results in a Page Not Found error.
Is there something within my .htaccess file that I can change/add so that a trailing slash is added to that URL automatically, but that won't break the rest of the site?
Here is my current .htaccess content:
# BEGIN Blog
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php
</IfModule>
# END Blog
I tried adding some code I found on a website whilst trying to fix this myself, but if I use it I get an Internal Server error 500. Here is what I tried adding:
# If path does not end in "/"
RewriteCond %{REQUEST_URI}!/$
# and does not contain a "."
RewriteCond %{REQUEST_URI}!\.
# then add trailing slash and redirect
RewriteRule ^(.*) /$1/ [R=301,L]
#This will redirect a page like domain.com/page to domain.com/page/
I can't get my head around the syntax used in htacess files, so any examples of what I should type and where is much appreciated

Message 1 of 3
(1,528 Views)
2 REPLIES 2
Re: Add trailing slash to URLs via .htaccess?
24-04-2010 5:15 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Could try <a href="http://community.plus.net/forum/index.php/topic,85111.msg705703.html#msg705703">this</a>.
Gabe
Gabe
Message 2 of 3
(495 Views)
Re: Add trailing slash to URLs via .htaccess?
24-04-2010 6:49 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks Gabe, you are indeed a Bright Spark
Your reply #8 in the Topic you linked to has fixed the issue I was experiencing.
I'm usually quite good at searching for an answer before creating a new topic, but I obviously didn't look hard enough this time.
Regards, Jules.

I'm usually quite good at searching for an answer before creating a new topic, but I obviously didn't look hard enough this time.
Regards, Jules.
Message 3 of 3
(495 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Add trailing slash to URLs via .htaccess?