I have these files in my My root, Inside pages i directory has the following structure:
/assets/ /pages/ /.htaccess index.pp Inside /pages/ I have phpPHP files for example projects.php For example,projects.php. I tried writing in .htaccess.htaccess rules to take the file for example xxx.com/projects toURL example.com/projects and open the file from /pages/projects.php/pages/projects.php and it worked with the following:
RewriteEngine On RewriteCond %{ENV:REDIRECT_STATUS} . [OR] RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ - [L] # No file extension on request then append .php and rewrite to subdir RewriteCond %{REQUEST_URI} /(.+) RewriteRule !\.[a-z0-4]{2,4}$ /pages/%1.php [NC,L] # All remaining requests simply get rewritten to the subdir RewriteRule (.*) /pages/$1 [L] My problem here is that when iI go to the root xxx.comexample.com, instead of opening index.php itsindex.php it’s opening pagesthe /pages/ directory, but if iI go explicitelyexplicitly to xxx.com/index.phpexample.com/index.php it works. I dont
I don’t want index.phpindex.php to be shown in the url iURL, so I need to exclude the root from my rule and make it open index.phpindex.php while the urlURL stays xxxexample.com.com