Jump to content

Recommended Posts

(anything).example.com/(anything) to example.com/(anything)

 

for example :

 

img1.example.com/test1.jpg to example.com/test1.jpg

 

img105.example.com/anotherimage.png to example.com/anotherimage.png

 

tdr.example.com/a.css to example.com/a.css

First you need to set-up wildcard subdomains on your DNS. Assuming this is done, something like this should work...

 

RewriteCond %{HTTP_HOST} !example.com

RewriteRule .* http://example.com/%{REQUEST_URI} [R=302]

 

Once you're happy it's working you can switch the 302 to 301.

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.