I want to rewrite the url like this:
http://localhost/public/viewbusiness.php?s=cyberbooger-web-services
into
http://localhost/viewbusiness.php?s=cyberbooger-web-services
thus removing the directory name in the url. You noticed that the viewBusiness.php is located in the public directory.
My application is not following the MVC architecture, and not using a framework. This is a application I am doing right as I currently studying PHP.
My folder structure is like this:
-- /app
-- /public
-- index.php
Can anyone help me? Thank you so much!
Try:
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^(\w+)/(\w+)$ $1/public/$2 [QSA] </IfModule>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.