Reputation: 73
I am running my php applications on
My Directory Structure is like this: C:\wamp\www\website
I have placed the .htaccess file in website folder.
<IfModule mod_rewrite.c>
#Turn on the RewriteEngine
RewriteEngine On
RewriteBase /website/
#Rules
RewriteRule ^(.*)$ index.php
</IfModule>
When ever i click on the index.php it takes me to the http://localhost:8085/ home page which is wrong i want to got to http://localhost:8085/website.
Please guide me
Upvotes: 0
Views: 1761
Reputation: 40639
You need to add your website
before index.php like,
RewriteRule ^(.*)$ /website/index.php
Updated, try the full code,
RewriteEngine On
RewriteBase /website/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /website/index.php [L]
Note: You need to use http://localhost:8085/website/
as base URL in every link which is used in your site, otherwise it will redirect to http://localhost:8085/
like,
<a href="http://localhost:8085/website/index.php">Home page</a>
Alternatively, do not use a /
before any href
and use your file name as it is for example,
<a href="index.php">Home page</a>
If you are using <a href="/index.php">Home page</a>
it will redirect to index page of URL http://localhost:8085/
You can make a Virtual Host to access it directly https://httpd.apache.org/docs/current/vhosts/name-based.html
Upvotes: 2