Forum Moderators: phranque

Message Too Old, No Replies

redirects and trailing slash /

         

evdboogaard

2:49 pm on Mar 16, 2007 (gmt 0)

10+ Year Member



Hello,

I've searched and searched and couldn't find the solution.
IT's about the trailing slash or rather when there isn't a trailing slash address in the URL field changes from the addon domain to a subdomain on the main domain. E.g.

www.addondomain.com/appdir
gets redirected to
addondomain.maindomain.com/appdir/admin/index.php
instead of
www.addondomain.com/appdir/admin/index.php

When www.addondomain.com/appdir/ is entered (with trailing slash) it does redirect correct to www.addondomain.com/appdir/admin/index.php

I've tried

RewriteRule ^/(([^/]+/)*([^/.]+))$ /$1/ [R=301] 

but I still get the same result.

Hope you can help me fix this.

Thanks,
Erwin

[edited by: jdMorgan at 3:41 pm (utc) on Mar. 16, 2007]
[edit reason] De-linked currently-active domain. [/edit]

jdMorgan

3:47 pm on Mar 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is likely a combination of the actions of mod_dir, multiviews, ServerName, and UseCanonicalName settings.

The simplest solution should be tried first: Correct your RewriteRule syntax to:


RewriteRule ^/(([^/]+/)*([^/.]+))$ [b]http:[/b]/[b]/www.addondomain.com[/b]/$1/ [R=301,L]

If that doesn't fix it, then research the Apache modules and directives mentioned above, and make sure that the settings are correct.

I'm also assuming that this code is to be used in httpd.conf or conf.d, because of the leading slash on your RewriteRule pattern. If that is not the case, and this code is in .htaccess, then remove that leading slash.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

evdboogaard

11:07 pm on Mar 18, 2007 (gmt 0)

10+ Year Member



Hi Jim,

Thanks for your reply.

It's indeed for .htaccess
I don't have a clue with what you mean by leading slash.
There are a couple of / in it, so I don't know. And that's probably the reason why it isn't working...

I look forward to your reply.

Thanks,
Erwin

jdMorgan

11:25 pm on Mar 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For use in .htaccess, as opposed to httpd.conf or conf.d,

RewriteRule [b]^/(([/b][^/]+/)*([^/.]+))$ http://www.addondomain.com/$1/ [R=301,L]

should be

RewriteRule [b]^(([/b][^/]+/)*([^/.]+))$ http://www.addondomain.com/$1/ [R=301,L]

Jim