Reputation: 26
I have root file and in root file public => index.php.I created .htaccess in root and wrote this code
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
to redirect from root to public/index.php but it is not working. localhost is wamp(apache)
Upvotes: 0
Views: 125
Reputation: 133428
If I get your question correctly, could you please try following. This simply checks if REQUEST_URI
is null then move further to rewriterule to redirect it in backend to index.php file
RewriteEngine ON
RewriteBase /
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ /public/index.php [L]
IMHO When you are using public/$1
in right side of your rewriterule $1
is empty since it's REQUEST_URI value is NULL because you are hitting base url, so its better to write /public/index.php
there.
Upvotes: 1