.htaccess - URL Rewriting I don't want to show index.php in url -
i running php applications on
my directory structure this: c:\wamp\www\website
i have placed .htaccess file in website folder.
<ifmodule mod_rewrite.c> #turn on rewriteengine rewriteengine on rewritebase /website/ #rules rewriterule ^(.*)$ index.php </ifmodule>
when ever click on index.php takes me http://localhost:8085/ home page wrong want got http://localhost:8085/website.
please guide me
you need add website
before index.php like,
rewriterule ^(.*)$ /website/index.php
updated, try full code,
rewriteengine on rewritebase /website/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /website/index.php [l]
note: need use http://localhost:8085/website/
base url in every link used in site, otherwise redirect http://localhost:8085/
like,
<a href="http://localhost:8085/website/index.php">home page</a>
alternatively, not use /
before href
, use file name example,
<a href="index.php">home page</a>
if using <a href="/index.php">home page</a>
redirect index page of url http://localhost:8085/
you can make virtual host access directly https://httpd.apache.org/docs/current/vhosts/name-based.html
Comments
Post a Comment