Forum Moderators: phranque
I was wondering if there is a way using which, if a person tries to access a site, say example.com without a slash at the end, could we make use of the htaccess file to append a slash at the end?
You guys might be wondering why I would want to do this. I have a genuine reason. I run a web directory which is powered by phpLD. It has something which I guess qualifies as a bug. I tried posting it on their forum for a fix but they havent given a fix yet. Let me demonstrate what the problem is and for this I'll have to use my site as an example. [If you tried] accessing this page:
http://www.example.com/computers_and_internet/web_directories
[You'd] see 8 subcategories. Lets take the subcat Paid Directories for example. If you accessed the page with the url I gave, you'd notice that the link to Paid Directories points to http://www.example.com/computers_and_internet/paid_directories/, which is WRONG!
It should point to, http://www.example.com/computers_and_internet/web_directories/paid_directories
If you were to access http://www.example.com/computers_and_internet/web_directories with a trailing slash, this problem wont happen. So I want to make sure, if a user doesn't put a slash at the end of the URL, apache automatically puts on there...
Please let me know if this is possible :)
Regards,
-- Naif
[edited by: jdMorgan at 3:09 pm (utc) on Dec. 22, 2006]
[edit reason] No URLs, please. See Terms of Service. [/edit]
Welcome to WebmasterWorld!
Have you tried a search [google.com] on this subject?
There are many examples of the code to do this already posted here. They should help get you started.
Jim