Forum Moderators: phranque
I wonder if anyone here can offer some help or advice please.
Can I base a rewrite rule on a URL specifying :80 within it. There are some URLs in the Google index that are like this [domain.com:80...]
Can I use the :80 to rewrite only URLs containing that specifically in them?
Thanks for any help.
Best wishes
Sid
I've never tried it, so I'm not sure that the "URL" as seen by RewriteRule or by RewriteCond %{REQUEST_URI} would contain the port number (I suspect it will not).
However, you may be able to test for the presence of a port specification using RewriteCond.
Something like:
RewriteCond %{HTTP_HOST} \:80$
RewriteRule <whatever you want to do here>
Jim
The browser (AFIAK) does not send the port number with the URI request.
I'm actually surprised that Google is displaying that - you'd think they'd strip of the :80. But, they're doing it because someone is linking to your site with it.
Sid: Maybe if you could describe a little more of what you want to do, we might be able to recommend a different solution.
Update: It does work in firefox, but not in Opera or IE.
Sid,
If the goal here is to get Googlebot to drop the port number from your listings in their index, I think the 301-redirect based on the {HTTP_HOST} method should work. If you want to redirect browsers, then it won't work for IE and Opera. :(
Jim