Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Help with trailing "/"
Old 09-07-2007, 11:56 AM Help with trailing "/"
Webmaster Talker

Posts: 626
Trades: 0
I don't really know where to post this message but hopefully someone here can help me. I was wondering if there is an easy way for my server to take away the trailing slash?

Some search engines are referring to my site like: http://www.mysite.com/section/category/item/

But that page link doesn't exist (I'm using Joomla! as a CMS). So they are getting a 404 error.

I can setup redirects to redirect to:
http://www.mysite.com/section/category/item

Doing this, everything works fine but it is getting tedious to go through EVERY page and setup a redirect since I have a lot of pages. Is there some general command that I can add to the .htaccess file which will do it for me?
jim.thornton is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-07-2007, 12:51 PM Re: Help with trailing "/"
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
I've never dealt with Joomla, but it sounds like Apache thinks your files are directories. The DirectorySlash Directive might need to be turned off.

http://httpd.apache.org/docs/2.0/mod/mod_dir.html

Worth a try
joder is offline
Reply With Quote
View Public Profile
 
Old 09-07-2007, 04:27 PM Re: Help with trailing "/"
Webmaster Talker

Posts: 626
Trades: 0
I'm a little confused as to how to make the change? I'm dealing with a shared hosting plan. Do I just make the change to the .htaccess file? Also, can it be generic... For example, no matter what url they type, it will remove the trailing slash?

I don't think this is a joomla thing.
jim.thornton is offline
Reply With Quote
View Public Profile
 
Old 09-07-2007, 04:54 PM Re: Help with trailing "/"
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
On making the change, Apache will not append a / to the end of a url that someone was accessing
There is an example at the bottom of the page that should work in a .htaccess file
joder is offline
Reply With Quote
View Public Profile
 
Old 09-07-2007, 05:50 PM Re: Help with trailing "/"
Webmaster Talker

Posts: 626
Trades: 0
I saw that example but it shows as :

# see security warning below!
<Location /some/path>
DirectorySlash Off
SetHandler some-handler
</Location>

The problem is that /some/path is specific... I can do that with a redirect (which I have been doing). But... i want to set it up so that whatever path is entered that I can turn off the slash.

Also, what is SetHandler?
jim.thornton is offline
Reply With Quote
View Public Profile
 
Old 09-07-2007, 06:07 PM Re: Help with trailing "/"
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
It's been awhile but I think just a / will take care of all subdirectories.
joder is offline
Reply With Quote
View Public Profile
 
Old 09-08-2007, 08:22 PM Re: Help with trailing "/"
Webmaster Talker

Posts: 626
Trades: 0
And what is the setHandler for?
jim.thornton is offline
Reply With Quote
View Public Profile
 
Old 09-08-2007, 08:31 PM Re: Help with trailing "/"
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
I think that is optional in this case.
http://httpd.apache.org/docs/2.0/mod...tml#sethandler
joder is offline
Reply With Quote
View Public Profile
 
Old 09-08-2007, 11:15 PM Re: Help with trailing "/"
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
Using htaccess, this should help

Code:
RewriteEngine On
RewriteRule ^(.*)/$ $1 [L]
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 09-09-2007, 01:15 AM Re: Help with trailing "/"
Webmaster Talker

Posts: 626
Trades: 0
Quote:
Originally Posted by mgraphic View Post
Using htaccess, this should help

Code:
RewriteEngine On
RewriteRule ^(.*)/$ $1 [L]
Thanks for that but it didn't remove the "/" on the end.
jim.thornton is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help with trailing "/"
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.51601 seconds with 12 queries