Link to home
Start Free TrialLog in
Avatar of daisydoos
daisydoos

asked on

htaccess - ensuring all requests go through public_html/index.php

Hi,

On my localhost , I have all of my files in a public_html folder to match the directory struture on the server (I won't go into the reasons for that!). So I have

c:/wamp/www/myproject/public_html

In public_html I have an .htaccess file which redirects everything through index.php:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

What I need to do is ensure that all requests eg http://localhost/myproject/somename.php get processed (through index.php) correctly rather than having to write http://localhost/myproject/public_html/somename.php all the time.

I've done a lot of searching on the topic but can't find a solution - not great at .htaccess!

Many thanks
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Grab a copy of the Laravel framework and follow their pattern for .htaccess.  This is exactly how it works!
http://laravel.com/
ASKER CERTIFIED SOLUTION
Avatar of Nir Lahad
Nir Lahad

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of daisydoos
daisydoos

ASKER

Many thanks for your help - worked with no problem