Combing .htaccess files
-
I am trying to move my WP installation from my /blog folder to my root directory. WP has an .htaccess and I also have a custom .htaccess file. I was trying to figure out by searching online if the order of things in the .htaccess file matters, but was unable to do so.
If someone could help me out by helping me figure out how to structure my merged .htaccess file I would really appreciate it.
My file (removes www from domain in address bar):
RewriteEngine on Options +FollowSymlinks RewriteCond %{HTTP_HOST} ^www\.domain.tld [NC] RewriteRule ^(.*) https://domain.tld/$1 [L,R=301]
WP file (don’t know what this does):
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog/index.php [L] </IfModule> # END WordPress
If I had to guess what is correct, I’d guess this (but I’m afraid to just do it and load i up in case it screws up something — could it?):
RewriteEngine on Options +FollowSymlinks RewriteCond %{HTTP_HOST} ^www\.domain.tld [NC] RewriteRule ^(.*) https://domain.tld/$1 [L,R=301] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteBase /blog/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog/index.php [L] </IfModule> # END WordPress
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Combing .htaccess files’ is closed to new replies.