.htaccess Rewrite Engine
-
Prior to installing WordPress, I had my .htaccess file set to redirect https://www.macbasement.com/* to https://macbasement.com/* (basically removes the ‘www’ prefix, because I find it unnecessary) I had this working with the following code in my .htaccess:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.macbasement.com$
RewriteRule (.*) https://macbasement.com/$1 [R=Permanent]
(Courtesy of John Gruber)When WordPress was installed, it modified my .htaccess file, adding the following code after my code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPressNow, “www.macbasement.com” returns a “page not found” error in my browser, while “macbasement.com” (sans ‘www’) works fine (WordPress permalinks and all)
I’m guessing there’s a certain way to combine two Rewrite rules, which I am not familiar with. Because separately, both codes work fine, but when combined they don’t work right together.
Could someone take the above two htaccess codes and combine them so they will work properly?
Thanks in advance.
- The topic ‘.htaccess Rewrite Engine’ is closed to new replies.