Reputation: 13
I have problem with correct redirection rule to www in my .htaccess file.
Nothing works properly instead standard
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Every other rule returns 404 File Not Found
on every subpage, except main page.
Does anybody have an idea how to do this without 404 error?
error for address - example.com/kontakt
Upvotes: 0
Views: 59
Reputation: 191
RewriteEngine On
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
# [NC] is a case-insensitive match
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
try this :)
Upvotes: 3
Reputation: 304
.htaccess
> RewriteEngine on
> RewriteCond %{HTTP_HOST} ^example\.com [NC]
> RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
also change the url to www to your prefix_options table if needed
Upvotes: 0