Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite & CNAME

Problem

         

gosman

1:43 pm on Apr 12, 2005 (gmt 0)

10+ Year Member



I have a mod rewrite that looks like the following

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^flights/(.*)$ [cname.mysite.com...]

[cname.mysite.com...] is a CNAME record that points to our supplier.

This worked perfectly fine on our old server.

I have now moved hosts and this no longer works. However if I replace [cname.mysite.com...] with the suppliers site.

Example

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^flights/(.*)$ [supplierssite.com...]

It works fine.

The rewrites appear be failing on any CNAMES we have setup.

Anybody got any ideas? It’s driving me mad.

jdMorgan

3:06 pm on Apr 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How long ago did you move the site? Are you sure the new DNS records have propagated? -- It usually takes hours, but in some cases, ISPs and hosts who don't update regularly can delay it by days. Or, if their update process is broken, it may never happen until you complain.

This is almost certainly a DNS problem, not a problem in your server.

Try Pinging and running TraceRt on the CNames -- that should give you an indication of whether the DNS is set up properly and has been updated.

Jim

gosman

3:16 pm on Apr 12, 2005 (gmt 0)

10+ Year Member



Thanks Jim.

I'm able to ping the CNAMES, I'm also able to browse to them.

Any other suggestions?

gosman

3:20 pm on Apr 12, 2005 (gmt 0)

10+ Year Member



Another weird thing I've just noticed. If I browse to the server by IP rather than domain name the rewrites work

?

jdMorgan

4:20 pm on Apr 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you flushed your browser cache(s) since the move? Also make sure you don't have these domains pre-/re-defined in the 'hosts' (it is named 'hosts' -- no file extension) file on your browser PC.

Jim

gosman

4:36 pm on Apr 12, 2005 (gmt 0)

10+ Year Member



Just to clarify.

I have even created new CNAMES which resolve fine. So it's not a DNS problem. It seems to be a problem when rewriting to a CNAME although if I browse the site by IP the rewrites work fine.

gosman

5:25 pm on Apr 12, 2005 (gmt 0)

10+ Year Member



FIXED.

I have amended the mod_rewrite rule to include [R,L] on the end of each rule the problem appeared to have been that a rewrite rule to a subdomain is treated as an internal link. The [R,L] treats it as an external url hence redirects to the full path specified.

It worked fine on the old server without the [R,L] not sure why.