Hi, I've been searching through a bunch of threads on these issues and have tried out code that has been listed and am still just stuck. So I though I would try and get some feedback on what I am doing wrong.
My setup is, I have domain.com and a root folder at /home/user/
I'm planning on having several sites so I am making individual domain folders, /home/user/domain.com/
In my .htaccess in /home/user/ I have:
Options +FollowSymLinks -Indexes +MultiViews
DirectoryIndex index.php index.xhtml index.html
DirectorySlash On
RewriteEngine On
#remove www
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
#add trailing slash for directories
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ http://domain.com/$1/ [R=301,L]
#Move default directory of domain.com from / to /domain.com/
RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteCond %{REQUEST_URI} !^/domain.com/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ domain.com/$1 [L]
RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteRule ^(/)?$ domain.com/index.php [L]
I added a wordpress under /home/user/domain.com/blog/
and two pages /home/user/domain.com/index.php and /home/user/domain.com/site/index.html
So here are my test cases and their outputs:
[
domain.com...] -> [
domain.com...] - correct
[
domain.com...] -> [
domain.com...] - why is it showing the folder structure?
[
domain.com...] -> [
domain.com...] - correct
[
domain.com...] -> [
domain.com...] - why does this get stuck in a loop and then 404 out?
[
domain.com...] -> [
domain.com...] - correct
So after reading a few posts I wanted to find out:
1)are my rules are correct for the task they suggest?
2)is the order of the rules sequentially correct?
3)are my modifiers and use of [R=301] and [L] correct?
4)Since there are no other .htaccess in the system except for this one, why does the mapping of /blog and /site differ so much? It seems like they should both have the same problem.
5) Why is the folder structure displayed for both?
6) Why does /blog go into an infinite loop?
Also, what is the difference between a redirect and a rewrite? Is a redirect with [R] and rewrite with [L]?
Sorry if the post is lengthy, I am just trying to be thorough because I am have been struggling with this for quite a few hours. Thanks for your time and I look forward to any suggestions!
Jacob