Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This has been the MOST helpful forum that I have been a part of and I want to say thank you. The tips, tricks and helpful advice that you all contribute to have been lifesavers in many instances..."

Geography

Where in the world do Tek-Tips members come from?

.htaccess rewrite to subdomain and redirect

vexxy (TechnicalUser)
23 Aug 12 5:08
Hey guys,

I'm in a bit of a situation. I want to change my rewrite rules for a folder to a subdomain and then redirect old rules to new ones (for SEO).

So basically I have this:

CODE --> apache

RewriteEngine On
RewriteBase /
RewriteRule ^news/index([0-9-]+)\.html$ index.php?page=pressrelease_homepage&pn=$1
RewriteRule ^news/$ index.php?page=pressrelease_homepage
RewriteRule ^press/([a-zA-Z0-9-]+)-([0-9-]+)\.html$ index.php?page=pressrelease_page&id=$2 

I want to rewrite everything www.site.com/news to press.site.com and everything /press/ to press.site.com. After I do this, I want to redirect all old links to the new subdomain links. I tried several methods but I wasn't very successful.

Any help will be greatful!
ChrisHirst (IS/IT--Management)
23 Aug 12 7:37
For folder to subdomain mod_alias rule is the way to go.

CODE

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/news/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/press/(.*)$
RewriteRule .* http://press.domain.tld/%1 [R] 

Quote (vexxy)

After I do this, I want to redirect all old links to the new subdomain links. I tried several methods but I wasn't very successful.

Example needed of the request URIs and the URI they are to go to

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

vexxy (TechnicalUser)
23 Aug 12 11:47
I want the primary press index that currenrlt www.site.com/news/ to go to press.site.com

The individual press release pages are like this: http://www.site.com/press/press-title.html and I want to press.site.com/press-title.html

Tnx alot in advance

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close