Jump to content

Redirect domain


Lumio

Recommended Posts

Try (example which will handle all top level domains and sites - remove wildcard backrefs and make specific as required)

 

RewriteEngine On
#RewriteLogLevel 9
#RewriteLog logs/rewrite.log
RewriteCond %{HTTP_HOST} ^(.*)\.(.*)(\..*)$ [nc]
RewriteRule (.*) http://%2%3/%1$1 [L]

 

For redirect change the last line - [L] to [L,R]

 

(Tested only on local machine)

Link to comment
Share on other sites

Actually, duh!!, snip the L, LR bit. Of course you should always need a redirect remapping to http://

However I tested locally and both forms worked OK ;)

 

A non-wildcard TLD form with wildcard subomain would be (say for localhost.com) ...

 

RewriteEngine On
#RewriteLogLevel 9
#RewriteLog logs/rewrite.log
RewriteCond %{HTTP_HOST} ^(.*)\.localhost\.com$ [nc]
RewriteRule (.*) http://localhost.com/%1$1 [L,R]

 

Tested on simulated localhost.com

 

#Faked hosts entry

127.0.0.1      graphics.localhost.com

127.0.0.1      localhost.com

 

Link to comment
Share on other sites

It doesn't work for me.

Even the log doesn't change.

RewriteEngine On
RewriteLogLevel 9
RewriteLog rewrite.log
RewriteCond %{HTTP_HOST} ^mubix\.citrosaft\.com$ [nc]
RewriteRule (.*) http://dev\.citrosaft\.com/index.php/Mubix [L,R]

 

Yesterday or some more I tried to use

RewriteEnginge On
RewriteRule ^(.*)$ index.php?title=$1

But it didn't work.

 

I don't know why. For the mainpage and other vHosts, Mod-Rewrite works.

Link to comment
Share on other sites

You have no path specified on the rewritelog so my guess either it is trying to open it in the wrong area to the one you are looking or cannot open due to insufficient rights in a "current" directory.

 

Until you can enable logging and watch the logs you're poking around in the dark

Link to comment
Share on other sites

I tried to create a writeable folder and wrote an absolute path. But it didn't work.

RewriteEngine On
RewriteLogLevel 9
RewriteLog /var/www/domain_dev.citrosaft.com/logs/rewrite.log
RewriteCond %{HTTP_HOST} ^mubix\.citrosaft\.com$ [nc]
RewriteRule (.*) http://dev\.citrosaft\.com/index.php/Mubix [L,R]

Link to comment
Share on other sites

Until you can enable logging and watch the logs you're poking around in the dark

 

Did you enable logs and look at them?

 

Not working in what way? Access/error logs still getting no hits? Sure?

 

Have you tried removing the \. and changing to just . in the rewrite?

 

RewriteEngine On
RewriteLogLevel 9
RewriteLog /var/www/domain_dev.citrosaft.com/logs/rewrite.log
RewriteCond %{HTTP_HOST} ^mubix\.citrosaft\.com$ [nc]
RewriteRule (.*) http://dev.citrosaft.com/index.php/Mubix [L,R]

 

Don't forget to disable rewrite logging after!!!!!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.