Change document root using .htaccess on wamp
.htaccess, apache
Solution
Use this rule in your `Retailer/.htaccess` file:
RewriteEngine on
RewriteBase /Retailer/
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
Problem
I have scratching my head over it for a long time now. Can't manage to get it to work. (I am a noob with apache that can be one reason also). Ok here is the problem in nutshell. I am using wamp and I have a directory `Retailer`. There is another directory inside it which is called public that contains the index and otherfiles. I want to make this `public` directory document root. I want to achieve this with `.htaccess` My Rewrite module for apache is turned on. Here is what I have tried: ``` RewriteEngine on RewriteBase /public/ RewriteRule ^index.php$ test.php ``` And also I have tried ``` RewriteEngine on RewriteCond %{HTTP_HOST} ^localhost/Retailer$ [NC,OR] RewriteCond %{HTTP_HOST} ^localhost/Retailer$ RewriteCond %{REQUEST_URI} !public/ RewriteRule (.*) /public/$1 [L] ``` And I have tried ``` RewriteEngine on RewriteCond %{HTTP_HOST} ^http://localhost/Retailer/$ [NC,OR] RewriteCond %{HTTP_HOST} ^http://localhost/Retailer/$ RewriteCond %{REQUEST_URI} !public/ RewriteRule (.*) /public/$1 [L] ``` But result in all these cases is the same. That is: Any help will be appreciated Ahmar