LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   mod rewrite question (https://www.linuxquestions.org/questions/linux-server-73/mod-rewrite-question-677250/)

jamsda 10-18-2008 12:33 AM

mod rewrite question
 
Hello,

Need some help rewriting from one subdomain to another that takes in account potentially old bookmarks from the old subdomain. I have a basic redirect like:

RewriteCond %{HTTP_HOST} ^oldsub.domain\.com$ [NC]
RewriteRule ^/(.*)$ http://newsub.domain\.com/$1 [R=301,L]

Which works fine. But on the RewriteCond I'm trying to figure out a wildcard for users that may have bookmarked eg (oldsub.domain.com/forum/something.php?do=thread). So everything to the right of oldsub.domain.com/ erased, and redirected to the newsub.domain.com

Any ideas? Would be much appreciated..

Thanks,
Jim

zmanea 10-18-2008 06:31 PM

It looks like what you currently have would send the request http://oldsub.domain.com/example to http://newsub.domain.com/example, but you really want it to wipe anything after the domain name. Take out the $1, example below.


RewriteCond %{HTTP_HOST} ^oldsub.domain\.com$ [NC]
RewriteRule ^/(.*)$ http://newsub.domain\.com [R=301,L]


All times are GMT -5. The time now is 06:20 PM.