Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: .htaccess rewriting and redirecting issue |
|
Author |
|
vexx
Joined: 23 Aug 2012 Posts: 1 Location: Romania
|
Posted: Thu 23 Aug '12 13:13 Post subject: .htaccess rewriting and redirecting issue |
|
|
I'm kinda new to Apache and .htaccess and I have a bit of a problem, maybe you guys can help out.
I want to change my rewrite rules for a folder to a subdomain and then redirect old rules to new ones.
Here are the current rules:
Code: | 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.
Thanks in advance for any tips/solutions. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Sat 22 Sep '12 23:27 Post subject: |
|
|
You can use RedirectMatch.
e.g.
Code: |
RedirectMatch ^/news/index([0-9-]+)\.html$ http://press.site.com/index.php?page=pressrelease_homepage&pn=$1
|
The press should be simular |
|
Back to top |
|
|
|
|
|
|