Forum Moderators: phranque

Message Too Old, No Replies

Adding a trailing slash using Mod_Rewrite

         

futureX

6:32 pm on Feb 4, 2004 (gmt 0)

10+ Year Member



Have tried searching these forums and also google, but I cant seem to fix the problem... I have a TLD setup on my main hosting account (e.g. foo.com ) but also have an addon domain setup on a subdomain (though cpanel) of that dir, so the real path is site.foo.com, but the other domain is domain.com, everything works fine and domain.com/directory/ goes to domain.com/directory/ but if i type domain.com/directory (without the trailing slash) it goes to site.foo.com/directory/ which is causing problems with google and other people linking to my site.

Does anyone have a way i can add a trailing slash to requests so that it will always direct to the correct domain?

I have tried the following, and it works for only the dir specified, how can i change it so that it and all subdirectories do the same:

RedirectMatch ^/directory$ [domain.com...]

jdMorgan

8:32 pm on Feb 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is likely due to a flaw in the cpanel code; cpanel occasionally writes some pretty bad code.

You might want to post cpanel's subdomain/subdirectory redirect code for comment, rather than adding yet another rule to work around it.

Jim