Forum Moderators: phranque

Message Too Old, No Replies

ModRewrite to subdomain seems to revert to www

Server config error?

         

surfgatinho

10:09 pm on May 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have a site which I'm just creating a French language version of.
The sites are www.domain and fr.domain

Now some of the countries have different speelings so I use a modrewrite on the Fr version from links on the En version:
RewriteRule ^Belgium/(.*)$ /Belgique/$1 [R=301,L]

What's happening is weird the rule is being recognised but it is redirecting to www.domain.../Belgique/ and hence a 404.
This is wierd as the rule is in the fr directory and the URL that is directing there is absolute?

Any idea what's going on?
Thanks,
Chris

jdMorgan

3:18 am on May 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried it like this?

RewriteRule ^Belgium/(.*)$ http://fr.example.com/Belgique/$1 [R=301,L]

Jim

surfgatinho

8:38 am on May 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi JD,
Yes I tried it that way, it still reverts to www.
Also if I just type the URL fr.domain.../Belgium/ it still redirects to the www address (but witht the rule applied i.e. with Belgique)

I'm a little confused and am beginning to suspect it might be time to contact the hosting company

jdMorgan

12:47 pm on May 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check for "UseCanonicalName [httpd.apache.org] on" in the server config. If present, turn it off.

Jim

surfgatinho

1:12 pm on May 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi JD,
It' shared hosting and I don't have access to the apache config. Do you know if I can set this via the .htaccess file?

Thanks again,
Chris

jdMorgan

1:15 pm on May 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, it's a server config setting. Contact your host to see if it's set.

Jim

surfgatinho

1:24 pm on May 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just have, thanks

surfgatinho

4:06 pm on May 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The reply:

Hello,

Unfortunately we are unable to assist customers with scripting issues and site development work.

We have a very lively customer forum, where other customers are more than willing to assist you with any scripting and development problems or questions you may have.

Please visit our forums below and search or post for answers to your scripting questions:...

Don't you just love it. It does wind me up when these people treat you like some sort of hobbyist who can't get their guestbook to work!

surfgatinho

4:07 pm on May 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



and...
The issue is not with the hosting. We run standard apache configurations. mod_rewrite is fully available for your rewrite rules but we're unable to assist with creating/debugging your rewrite rules.

jdMorgan

5:54 pm on May 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the following rule is running, but you still end up redirecting to www, then it's a config problem. Consider trying it with a site on a different hosting company.

RewriteRule ^Belgium/(.*)$ http://fr.example.com/Belgique/$1 [R=301,L]

Use a server headers checker, such as Firefox's "Live Headers" extension or an on-line equivalent, to 'follow' all redirects. If you see the rule do a redirect, followed by another redirect to "www" that is not being done in your own config files, then you're going to need to put the pressure on your host; Let them know you want to know how your server account is configured, especially the UseCanonicalName setting.

If they won't help, then move your site to a better host first, and then contact the old host and tell them why. They're doing a simple cost/benefit analysis on support expenditures. If they won't support you, give them something to put into the "cost" column. There's too amny fish in the sea --and too many hosting companies-- to put up with something that you don't like or that hurts your site.

Jim

surfgatinho

6:30 pm on May 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In all fairness they have said they will look into it after I sent them the details of the phpinfo() command showing SCRIPT_URI and SERVER_NAME on the subdomain both showed www

Thanks for the help, will see what happens

surfgatinho

10:16 pm on May 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Good on them - they fixed it!
Exactly what you said JD the CanonicalName issue.

Thanks for that

jdMorgan

12:14 am on May 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What's their address? -- I'll send them an invoice... ;)

Glad you got it working!

Jim