Forum Moderators: phranque

Message Too Old, No Replies

Subdomain Redirect Question .htaccess?

         

erickroyer

9:21 pm on Nov 1, 2010 (gmt 0)

10+ Year Member




Hi

I have a site made in drupal. I have a file structure setup as www.mysite.com/123456 where the 123456 is the page of content .

We are a magazine publisher and we want to redirect our readers back to the website for more content to support the articles. Like PC World does..

We want to use a URL setup similar to PC World with FIND.MYSITE.com/123456.

What I need to know is how to setup the server (or any other way) where both FIND.MySITE.com/123456 and WWW.MYSITE.com/123456 point to the same place.

Currently I am manually adding a redirect for each instance of this FIND url. There could be 20+ per issue so after a while I will have hundreds of URL redirects in the Cpanel on the server.

Is there any other way to make this work? Using .htaccess?

Thank you

sublime1

2:59 pm on Nov 4, 2010 (gmt 0)

10+ Year Member



Eric --

I looked at your question when you posted it, but I really don't think I understand what you mean. Could you provide an example of the PC World URL structure you want to mimic.

Having done battle with Drupal for the last year, I would be cautious, in general with messing with its URLs. Drupal has an extensive .htaccess that most requests go through, so you'll need to be careful not to get in the way of that. You may also want to consider one of the Drupal modules that handle redirection (path_redirect and global_redirect).

If this doesn't work, please describe your problem, what you have tried so far, etc.

Tom

g1smd

3:02 pm on Nov 4, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You absolutely do not want FIND.MySITE.com/123456 and WWW.MYSITE.com/123456 to directly point to the same place, as that is Duplicate Content.

If the "numbers" are the same in both URLs, a one line RewriteRule is all that is needed to implement a redirect from one URL to the other. This rule can cater for all of your URLs.

erickroyer

9:19 pm on Nov 4, 2010 (gmt 0)

10+ Year Member



How would this rewrite rule look? and where do you place it?

Thank you

jdMorgan

6:20 pm on Nov 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> What I need to know is how to setup the server (or any other way) where both FIND.MySITE.com/123456 and WWW.MYSITE.com/123456 point to the same place.

Set the find.mysite.com subdomain as a ServerAlias for mysite.com and www.mysite.com
OR
if you have two (or more) ServerName sections already, then just set their DocumentRoots to point to the same filespace.

Then, taking g1smd's comments to heart, implement a 301 redirect from find.mysite.com/<numbers> to www.mysite.com/<numbers> to prevent duplicate content issues. In .htaccess, that would look something like this:

RewriteCond %{HTTP_HOST} ^find\.mysite\.com
RewriteRule ^([0-9]+)$ http://www.mysite.com/$1 [R=301,L]

Jim