1

There are SO many questions on this I know, but there always seems to be a lack of complete understanding on my part about htaccess files. My file is really simple (taken from Bluehost as with other projects):

RewriteEngine on 
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www.)?theglobalhuman.com$ 
RewriteCond %{REQUEST_URI} !^/www/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /www/$1 

My folder structure (in a nutshell) is:

root
 |-- app
      |--templates
            |-- admin
            |-- public
 |-- tmp
 |-- www
 |-- .htaccess

Where www has the index file.

So if I go to website.com, things are fine. If I go to website.com/something/more, that works fine, which hits the templates/public folder.

However, if I go to website.com/admin/more, which goes to the templates/admin folder, for some reason the htaccess breaks and inserts www into the url. Has anyone ever has this problem?

Martavis P.
  • 1,708
  • 2
  • 27
  • 45

1 Answers1

0

I think the answer could be the rewrite_base rule, from this post by @jonlin.:

if it's in the "subdir2" directory, and you go to http://example.com/subdir2/foo, mod_rewrite will mistake the relative path as a file-path instead of a URL-path and because of the R flag, you'll end up getting redirected to something like: http://example.com/var/www/localhost/htdocs/subdir1. Which is obviously not what you want.

I would check out the rest of his answer, it is quite comprehensive.

Community
  • 1
  • 1
SimonStern
  • 308
  • 2
  • 12
  • Thanks for the reply, but I'm still having a hard time. The answer helped me understand more on how to use htaccess, but I'm still stuck. I just edited my question to clarify more. – Martavis P. May 01 '16 at 03:47