Forum Moderators: phranque
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^mydomain.com [nc]
rewriterule ^(.*)$ h**p://www.mydomain.com/$1 [r=301,nc]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ h**p://www.mydomain.com/ [R=301,L]
RewriteCond %{QUERY_STRING} .
RewriteRule ^index\.php$ /random_text.html? [L]
Before, all my index.php pages were being 301'd to / including the homepage and all sub directories... However, now I've written it from scratch, only the homepage is being rewritten.
How do I get it to redirect index.php to / for all directories.
In fact, I also want to do index.html as well.
My second question... I can't figure out how to redirect an old subdomain to a new one... there's plenty on how to redirect to a subdirectory but I can't find anything on redirecting to another subdomain. Is it the same method for redirecting www.foobar.com to www.barfoo.com?
Thanks ;-)
[edited by: Asia_Expat at 1:32 pm (utc) on July 17, 2006]
> there's plenty on how to redirect to a subdirectory but I can't find anything on redirecting to another subdomain. Is it the same method for redirecting www.foobar.com to www.barfoo.com?
Yes, the same method used to *rewrite* a subdomain to a subdirectory can be modified to *redirect* one subdomain to another.
Change the broken pipe characters in the code above to solid pipes before use.
Jim
I'm curious though... and I'm sure it's a daft question but why did you post with broken pipes when they should be solid?
Here's mine now...
[code]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(php¦html)\ HTTP/
RewriteRule ^([^/]+/)*index\.(php¦html)$ h**p://www.umpa-lumpa.com/$1 [R=301,L]
[code]
Edit: Oh, now I see why LOL
[edited by: Asia_Expat at 7:05 pm (utc) on July 17, 2006]