Jump to content

Quick redirect?


Cory94bailly

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/194828-quick-redirect/
Share on other sites

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]

Link to comment
https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024444
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024475
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024493
Share on other sites

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)

Link to comment
https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024499
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024507
Share on other sites

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..

Link to comment
https://forums.phpfreaks.com/topic/194828-quick-redirect/#findComment-1024520
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.