Redirecting to Index file in virtual host with htaccess when request file not found

O

Owais Akber

Guest
I need a small help.I have set virtual host in my xampp to access my sites.

I created a folder my-project in htdocs folder and set virutal host by following,

i edited hosts file in widows\system32\drivers\etc folder and added this line

127.0.0.1 my-project.com www.my-project.com

After that, i edited file httpd-vhosts in D:\xampp\apache\conf\extra folder and added following code.


DocumentRoot "D:/xampp/htdocs/my-project"

ServerName my-project.com

ServerAlias www.my-project.com


Now, I can access my project with the uri my-project.com/public and index file is loaded, but the problem comes in .htaccess file which i have created under public folder (same folder which contain index.php file) with following lines.


Options -Multiviews

RewriteEngine On

RewriteBase /my-project/public

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]


Now problem is that if i type my-project/public/somefile.php and file does not exist then it is not redirecting to index.php file under public folder.

Could anyone please advise the solution

Continue reading...
 
Top