Cory94bailly Posted March 10, 2010 Share Posted March 10, 2010 Hi. I am trying to make it so these rules are followed: MYSITE.net/WHATEVER > MYSITE.net/_forum/WHATEVER (Note: I want it to show as MYSITE.net but be at /_forum) forum.MYSITE.net/WHATEVER > MYSITE.net/WHATEVER blog.MYSITE.net/WHATEVER > MYSITE.net/STATIC-PAGE Everything I have tried just gave me a 500 error.. Any help? Quote Link to comment https://forums.phpfreaks.com/topic/194828-quick-redirect/ Share on other sites More sharing options...
roopurt18 Posted March 10, 2010 Share Posted March 10, 2010 This might do it: RewriteEngine on #MYSITE.net/WHATEVER > MYSITE.net/_forum/WHATEVER (Note: I want it to show as MYSITE.net but be at /_forum) #forum.MYSITE.net/WHATEVER > MYSITE.net/WHATEVER RewriteCond %{HTTP_HOST} ^MYSITE\.net RewriteCond %{HTTP_HOST} ^forum\.MYSITE\.net [OR] RewriteRule (.*) _forum/$1 [QSA,L] #blog.MYSITE.net/WHATEVER > MYSITE.net/STATIC-PAGE RewriteCond %{HTTP_HOST} blog\.MYSITE\.net RewriteRule .* STATIC-PAGE [L] Quote Link to comment https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024444 Share on other sites More sharing options...
Cory94bailly Posted March 10, 2010 Author Share Posted March 10, 2010 This might do it: RewriteEngine on #MYSITE.net/WHATEVER > MYSITE.net/_forum/WHATEVER (Note: I want it to show as MYSITE.net but be at /_forum) #forum.MYSITE.net/WHATEVER > MYSITE.net/WHATEVER RewriteCond %{HTTP_HOST} ^MYSITE\.net RewriteCond %{HTTP_HOST} ^forum\.MYSITE\.net [OR] RewriteRule (.*) _forum/$1 [QSA,L] #blog.MYSITE.net/WHATEVER > MYSITE.net/STATIC-PAGE RewriteCond %{HTTP_HOST} blog\.MYSITE\.net RewriteRule .* STATIC-PAGE [L] Ok.. So when I go to MYSITE.net, it works like it should.. But when I go to forum.MYSITE.net, it does nothing.. It just keeps me on forum.MYSITE.net.. And how can I make it so blog.MYSITE.net redirects to MYSITE.net? I tried putting it right it but it gave me a 500. Quote Link to comment https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024475 Share on other sites More sharing options...
roopurt18 Posted March 11, 2010 Share Posted March 11, 2010 Oops. I have the [OR] on the wrong line. RewriteEngine on #MYSITE.net/WHATEVER > MYSITE.net/_forum/WHATEVER (Note: I want it to show as MYSITE.net but be at /_forum) #forum.MYSITE.net/WHATEVER > MYSITE.net/WHATEVER RewriteCond %{HTTP_HOST} ^MYSITE\.net [OR] RewriteCond %{HTTP_HOST} ^forum\.MYSITE\.net RewriteRule (.*) _forum/$1 [QSA,L] I'm not sure what you want with the blog.MYSITE.net anymore. If you redirect from blog.MYSITE.net to MYSITE.NET it's going to redirect again to _forum. Is that what you want? Quote Link to comment https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024493 Share on other sites More sharing options...
Cory94bailly Posted March 11, 2010 Author Share Posted March 11, 2010 Oops. I have the [OR] on the wrong line. RewriteEngine on #MYSITE.net/WHATEVER > MYSITE.net/_forum/WHATEVER (Note: I want it to show as MYSITE.net but be at /_forum) #forum.MYSITE.net/WHATEVER > MYSITE.net/WHATEVER RewriteCond %{HTTP_HOST} ^MYSITE\.net [OR] RewriteCond %{HTTP_HOST} ^forum\.MYSITE\.net RewriteRule (.*) _forum/$1 [QSA,L] I'm not sure what you want with the blog.MYSITE.net anymore. If you redirect from blog.MYSITE.net to MYSITE.NET it's going to redirect again to _forum. Is that what you want? Yes, that's what I do want it to do.. Hmm, I'm not sure what I changed but the blog redirect works now.. Now it's just that "forum.MYSITE.net" doesn't redirect me anywhere (still).. I'm trying 2 different browsers and I cleared my cache on both. (And I just tried a proxy) Quote Link to comment https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024499 Share on other sites More sharing options...
roopurt18 Posted March 11, 2010 Share Posted March 11, 2010 I'm not really sure why the forum.MYSITE.net redirect wouldn't be working. My RewriteCond lines essentially say if the host is "MYSITE.net" or "forum.MYSITE.net" then redirect to "_forum" You might try some logging. http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog Quote Link to comment https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024507 Share on other sites More sharing options...
Cory94bailly Posted March 11, 2010 Author Share Posted March 11, 2010 I'm not really sure why the forum.MYSITE.net redirect wouldn't be working. My RewriteCond lines essentially say if the host is "MYSITE.net" or "forum.MYSITE.net" then redirect to "_forum" You might try some logging. http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog I tried putting this in my .htaccess: RewriteLog "/home/moddlnet/public_html/rewrite.log" But it gave a 500.. (I tried putting it at the top and at the bottom.. both 500.) I'm on shared hosting btw.. Quote Link to comment https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024520 Share on other sites More sharing options...
roopurt18 Posted March 11, 2010 Share Posted March 11, 2010 You may need to set RewriteLogLevel too. Or your host may be forbidding it. Quote Link to comment https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024524 Share on other sites More sharing options...
Cory94bailly Posted March 11, 2010 Author Share Posted March 11, 2010 You may need to set RewriteLogLevel too. Or your host may be forbidding it. Just tried that.. I'm pretty sure they blocked it.. I was just reading their FAQ and I saw something that they were running in "CGI Mode"... Quote Link to comment https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024529 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.