Web Hosting Forum | Lunarpages

Author Topic: 301 redirect problem  (Read 5310 times)

Offline masonbarge

  • Spacescooter Operator
  • *****
  • Posts: 36
301 redirect problem
« on: August 11, 2012, 07:04:29 AM »
Hi.  I have a VPS account using Lunarpanel (LPCP).  I have a domain listed as "dailyprayer.us".

Google and several other services tell me I do not have a 301 redirect from "www.dailyprayer.us" to "dailyprayer.us".

I have the following in .htaccess in my public_html folder:

Code: [Select]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.dailyprayer.us$
RewriteRule ^(.*)$ "http\:\/\/dailyprayer\.us\/$1" [R=301,L]

Can anyone tell me what my problem might be?  Google really doesn't life soft redirects.

Thanks.
"If this is coffee, please bring me some tea. If this is tea, please bring me some coffee."

                  ~ Abraham Lincoln

Offline MrPhil

  • Senior Moderator
  • Berserker Poster
  • *****
  • Posts: 6196
Re: 301 redirect problem
« Reply #1 on: August 11, 2012, 09:56:12 AM »
I can't see anything obviously wrong, if this is in the root (public_html) directory. Just for giggles, try cleaning it up a bit:
Code: [Select]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.dailyprayer\.us
RewriteRule ^(.*)$ http://dailyprayer.us/$1 [R=301,L]

The www.dailyprayer.us in the RewriteCond is a regular expression (pattern), so periods should be escaped. The replacement string in the RewriteRule is not a regular expression, so it doesn't need escapes.

I can see that when I type in www.dailyprayer.us, it is changing in the browser address bar to dailyprayer.us. So, the current 301 is working. Why search engines are telling you it's not working, the only thing I can suggest is that they don't like your formatting of the lines (escapes in the RewriteRule) for some reason.
Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-

 

Share |