Alf
Alf

Reputation:

Wordpress site cannot open without www prefix in chrome

I tried googling this problem about a site do not open without www in chrome, But it works on other browser, here's my .htaccess

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

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Upvotes: 0

Views: 2922

Answers (1)

Eugene Manuilov
Eugene Manuilov

Reputation: 4361

You have mistake in your .htaccess file. You activate rewrite engine twice. Your .htaccess file has to be like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^mydomain.com$
RewriteRule ^(.*)$ "http\:\/\/www\.mydomain\.com\/$1" [R=301,L]

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Update:

You can't open your site in chrome without www. because your .htaccess file contains redirection rule, what redirects your visitors from mydomain.com to www.mydomain.com. This rule is used for SEO, read through Redirection SEO Best Practices article (especially Redirecting Canonical Hostnames paragraph) to become more familiar with it.

Upvotes: 1

Related Questions