Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 24, 2012, 08:26:26 AM

Pages: [1]   Go Down
  Print  
Author Topic: URL redirect screwed up  (Read 2782 times)
BadFish
Trekkie
**
Offline Offline

Posts: 12


« on: February 26, 2011, 02:52:05 PM »

Hello,
   I changed something and now my URL redirection is messed up.
When I go to www.mydomain.com it takes me to http://servername.lunarservers.com/~name/cgi-bin//YaBB.pl

When I check namesecure settings for www.mydomain.com it is set to use the namesure dns servers.

My .htaccess file shows:


RewriteEngine on

AddHandler application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ "http\:\/\/mydomain\.net\" [R=302,L]

RewriteCond %{HTTP_HOST} ^mydomain.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.net$
RewriteRule ^/?$ "http\:\/\/servername\.lunarservers\.com\/\~name\/cgi\-bin\/YaBB\.pl" [R=301,L]

Any advise?
Logged
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5214



« Reply #1 on: February 26, 2011, 05:09:14 PM »

These lines may not be needed any longer:
Code:
AddHandler application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
If PHP 5 is now your server default, you can get rid of them. If not, move them before "RewriteEngine On" (just for clarity).

These lines
Code:
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ "http\:\/\/mydomain\.net\" [R=302,L]
are apparently meant (I guess) to force mydomain.net if someone comes in with www.mydomain.net. If that's the intent, the correct code is
Code:
RewriteCond %{HTTP_HOST} ^www\.mydomain\.net$
RewriteRule ^(.*)$ http://mydomain.net/$1 [R=301,L]
It's good, for search engine ranking purposes, to pick one or the other (mydomain.net or www.mydomain.net) and stick with it.

These lines
Code:
RewriteCond %{HTTP_HOST} ^mydomain.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.net$
RewriteRule ^/?$ "http\:\/\/servername\.lunarservers\.com\/\~name\/cgi\-bin\/YaBB\.pl" [R=301,L]
are causing your problem. Did you put that code in? Whether you come in on mydomain.net or www.mydomain.net, if just the domain name is given it sends your visitor to your ancient YaBB forum. Are you really still running YaBB? SMF is its modern descendant. Anyway, if you put that code in, what were you trying to do? Is it going to your account or someone elses? (is it a hack?)
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
BadFish
Trekkie
**
Offline Offline

Posts: 12


« Reply #2 on: February 27, 2011, 10:21:09 AM »

Yes, I entered that code. The line is the path to my forum, I wanted www.mydomain.com to go directly to the forum. I have been planning on upgrading it, i'll look into SMF as an option.

So basicly I just want users going to www.mydomain.com or mydomain.com to be directed to server.lunarserver.com/mysite
Logged
Jawadt
Space Explorer
***
Offline Offline

Posts: 8


« Reply #3 on: February 27, 2011, 11:00:35 AM »

Is there any special reason you don't want to use your domain name in the redirected URL and use the hostname. server.lunarserver.com/mysite should not be a valid URL, unless you wanted to write server.lunarserver.com/~username/mysite where username is to be replaced by your actual panel username. It is advisable you apply redirects via cPanel or LPCP whichever you have with your package, rather than manually writing redirects. Guidelines for applying domain redirects in both panels are available in the links below.

http://wiki.lunarpages.com/Redirect_Domain_Management_in_LPCP
http://wiki.lunarpages.com/Redirect_Pages_in_cPanel

If you continue to face any issues, please contact support and we will be more than glad to assist you in any way.

P.S. As MrPhil said, you might want to change 302 with a 301 but it is advisable you check implications of both online before you choose your preferred one.

Yes, I entered that code. The line is the path to my forum, I wanted www.mydomain.com to go directly to the forum. I have been planning on upgrading it, i'll look into SMF as an option.

So basicly I just want users going to www.mydomain.com or mydomain.com to be directed to server.lunarserver.com/mysite
Logged
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5214



« Reply #4 on: February 27, 2011, 12:50:25 PM »

So, if a visitor comes in with no URI (just the bare domain name), you want to send them to your forum? You can omit the RewriteCond line and the [L] flag if you wish:
Code:
RewriteCond  %{HTTP_HOST}  ^(www\.)?mydomain\.net$ [NC]
RewriteRule ^/?$ /cgi-bin/YaBB.pl [L]
should work, as you need to give the proper directory and YaBB.pl isn't by default searched for. I would not make this a 301 or 302 redirect, but leave the original URL intact. Otherwise, search engines will list the YaBB.pl file, and when you change to SMF (or add a landing page) you'll have to start over with the Search Engines.
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
Pages: [1]   Go Up
  Print  
 
Jump to: