homepage Welcome to WebmasterWorld Guest from 54.166.66.204
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Reverse Lookup Issues
chalkywhite




msg:4627075
 9:30 pm on Dec 1, 2013 (gmt 0)

Hi guys ( not even sure this is the correct forum so if this needs moving mods then please do :) ).

Recently moved all my sites to a VPS, all the sites are fine, but when I do a check to see what other sites are hosted on this IP it shows one site as;

domain.com
www.domain.com

Where as all the other sites just show www.domain.com. Ive set the canonical url on all pages as www. The site is Wordpress driven

Now ive checked all DNS settings on all sites to compare and they all have the correct a records, cnames etc. So im at a loss. The only thing that im not 100% on as im no apache expert is the rewrites. I want all non www to go to www.

This is the directives ive set in apache.

DocumentRoot "/var/www/domain.com/public_html"
<Directory "/var/www/domain.com/public_html">
Options FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^http://domain.com$ [NC]
RewriteRule ^(.*)$http://www.domain.com/$1 [R=301,L]
Options +Indexes
</Directory>

Are they fine and I still have to find what is causing this?

 

lucy24




msg:4627085
 11:15 pm on Dec 1, 2013 (gmt 0)

Options FollowSymlinks
<snip>
Options +Indexes

Is there a reason for having this as two separate items when they're both inside the same <Directory> section?

RewriteCond %{HTTP_HOST} ^http://domain.com$ [NC]

Whoops! Does it really say that, or did you go into autopilot when typing the post? This line should say

RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$

No protocol-- that would be a separate ruleset, if needed-- and the condition should be expressed negatively as "If the host is anything other than the form I want".

chalkywhite




msg:4627152
 10:32 am on Dec 2, 2013 (gmt 0)

Hi Lucy, yep that's what it says, was a copy and paste bar the domains. I'm rubbish with this sort of stuff ;).

Ive changed the Rewite condition, thanks! .

There is no particular reason for the two separate items, how would you configure this line?

lucy24




msg:4627229
 4:56 pm on Dec 2, 2013 (gmt 0)

If you use the
Options +blahblah -blahblah
form, you can put everything on a single line. The only time you'd need to use
Options blahblah otherblahblah
without plusses is when you need to be absolutely certain you're starting with a clean slate: "Only these options and no others." Otherwise use plus and minus forms: "Add this option if it isn't there already / Remove this option if it was previously enabled".

chalkywhite




msg:4627279
 7:39 pm on Dec 2, 2013 (gmt 0)

Brilliant thanks. Thought id put some time in today and read the options directive. It now makes more sense.

[httpd.apache.org...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved