TwelvestoneBack End

.htaccess redirect help


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
Technomancer
 
2010-08-10

mods - please move to correct forum after I have had some eyes look at this - it's urgent.

The problem - we have 3 domains all pointing to the same webspace. The underlying code determines what to serve up depending on the requesting url.

The application also need url rewriting for the underlying app (written using cakePHP)

We also have some old urls bookmarks that we need redirect.

my domains:

domain1.com domain2.com domain2.co.uk

I need domain2.co.uk to automagically redirect to domain2.com I need any of the domains with a /international to redirect to domain1.com

Then there is the basic rewrite for cakephp

my .htacces looks like this

RewriteEngine On RewriteBase / Options -Indexes Options +FollowSymLinks RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f

Redirect /internationalhttp://www.domain1.com [L] Redirect domain2.co.ukhttp://www.domain2.com [L]

RewriteRule .*$ index.php?url=$1 [qsa]

I have 2 problems

domain2.co.uk does not redirect to domain1.com

any request suffixed with /international is being rewritten by the last rule: ?url=international

what am I missing, what am i doing wrong?

Stickman
 
2010-08-10

To redirect the domain:

rewritecond %{http_host} domain2.co.uk [nc] rewriterule .*$http://domain2.com/$1 [r=301,nc]

...you might need to do some extra work to catch different versions of the original URL (eg. ww w .domain.co.uk *)

*spaces to prevent the URL from being rewritten by the forum software)

Stickman
 
2010-08-10

For the /international bit:

rewritecond %{REQUEST_FILENAME} /international [nc] rewriterule .*$http://domain1.com [r=301,nc]

Technomancer
 
2010-08-10

Originally posted by: Stickman For the /international bit:

rewritecond %{REQUEST_FILENAME} /international [nc] rewriterule .*$http://domain1.com [r=301,nc]

Thanks Stick but that's not working - I need the page to redirect so that URL is set to domain1.com

Stickman
 
2010-08-10

The forum software has removed the http :// from the front of the domain name. Add it back in and try again.

swampy
 
2010-08-10

stupid forum software

Technomancer
 
2010-08-10

Thanks Stickman

mods, do yer stuff, thanks.

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneBack End

.htaccess redirect help