This is my htaccess:
## Rewrites
<IfModule mod_rewrite.c>
RewriteEngine On
Redirect /stream/ http://twitch.tv/8wayrun
Redirect /stream http://twitch.tv/8wayrun
RewriteCond %{HTTP_HOST} ^(www\.)?8wayrun\.com$
RewriteRule ^(.*)$ http://8wayrun.com/calibur/$1 [R=302,L]
</IfModule>
Basically, I need to to rewrite 8wayrun.com/stream to twitch.tv/8wayrun...
And then I need it to rewrite 8wayrun.com to 8wayrun.com/calibur...
The problem is, its rewriting 8wayrun.com/stream to 8wayrun.com/calibur/stream. How do I fix this?
htaccess rewrite rules can be used to direct requests for one subdirectory to a different location, such as an alternative subdirectory or even the domain root. In this example, requests to http://mydomain.com/folder1/ will be automatically redirected to http://mydomain.com/folder2/.
The Redirect
directive is part of mod_alias, and the Rewrite*
directives are part of mod_rewrite. When a URI gets processed through the URL/file mapping pipeline, both modules get applied so having one in front of the other doesn't matter, both will get applied in the end.
You're better off sticking with only mod_rewrite and using the L
flag to prevent the extra redirects from geting applied.
## Rewrites
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/?stream/? http://twitch.tv/8wayrun [R=302,L]
RewriteCond %{HTTP_HOST} ^(www\.)?8wayrun\.com$
RewriteRule ^(.*)$ http://8wayrun.com/calibur/$1 [R=302,L]
</IfModule>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With