Off Topic

5 replies to this thread. Most Recent

pandion

15 Oct 2009, 1:23 pm

Apache mod_rewrite [Have-Host]

I have on Have-Host a website that when you go to:

http://macusersuk.org/offers/offers.php

Instead of:

http://www.macusersuk.org/offers/offers.php

And try to get an offer code, the user gets this error:

You may not access this page directly: please follow the correct route
Referrer was:
http://macusersuk.org/offers/requestoffercode.php?OfferCode=IPNM

Is there an easy way to use mod_rewrite function to change incoming requests for http://macusersuk.org to http://www.macusersuk.org

???

Best wishes Peter

================================ Peter Tucker, Oxford UK [email protected]

Paul

16 Oct 2009, 8:21 am

This in your .htaccess file may well do the job:

RewriteEngine ON RewriteRule ^(.*)$ http://www.macusersuk.org$1 [R=301,L]

More about this here: http://www.gnc-web-creations.com/301-redirect.htm

All the best,

Paul

My Actions Site: http://www.actionsworld.com

Actions for Galleries, decorating that text box and many more!

pandion

16 Oct 2009, 8:43 am

on 16/10/2009 09:21, Paul at [email protected] wrote:

This in your .htaccess file may well do the job:

RewriteEngine ON RewriteRule ^(.*)$ http://www.macusersuk.org$1 [R=301,L]

More about this here: http://www.gnc-web-creations.com/301-redirect.htm

Cheers Paul, much appreciated.

I’m interested in your Joomla actions, I’ll be looking at them over the next few weeks ;~}}

Best wishes Peter

================================ Peter Tucker, Oxford UK [email protected]

waltd

16 Oct 2009, 11:58 am

This is one of the classic examples given in the Mod Rewrite manual:

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://www.example.com/$1 [L,R]

The key to this is to not rewrite all requests to www, Paul’s solution absolutely will work, but it will put all requests through the redirect. The first two lines of this rule check to see if the host is already correct, or if it’s missing, and only if it’s missing, then redirect.

Walter

Freeway user since 1997

http://www.walterdavisstudio.com

James Wilkinson

16 Oct 2009, 11:28 pm

Hello!

Popping in here to say that the domain is not pointing to the server… it is being redirected… This means that there is no A Record for the domain… The server is configured to recognize both www.domain.blah or domain.blah.

Cheers! James