I'm developing a site at the moment and noticed when I uploaded it to my staging server, all my links show correctly in the address bar, but show the index template.
My folder structure is as follows
/
/pub
index.php
.htaccess
/system
/templates
.htaccess
My site runs inside /pub - Because I'm not able to specify with my host what the root directory of a site should be, they've advised that I use htaccess instead.
That .htaccess file sits in / and looks like this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^stage.domain.co$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.stage.domain.co$
RewriteCond %{REQUEST_URI} !pub/
RewriteRule (.*) /pub/$1 [L]
I also have a .htaccess file in /pub/ which looks like this:
# Enable Rewrite Engine
# ------------------------------
RewriteEngine On
RewriteBase /
# Redirect index.php Requests
# ------------------------------
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
RewriteCond %{THE_REQUEST} ^GET
RewriteRule ^index\.php(.+) $1 [R=301,L]
# Standard ExpressionEngine Rewrite
# ------------------------------
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
I want to remove index.php, AND the pub directory so my site will serve up URLs such as stage.domain.com/exercises instead of stage.domain.com/pub/index.php/exercises
So two questions.. Should I be using two htaccess files like I am at the moment, one to redirect from /pub/, and one to remove index.php, or should they be in one file, and where should it be?
What needs to be in those files to make it work?! I've tried what EE suggested by removing the slash before index.php on the last line, and adding a question mark.