简体   繁体   中英

mod_rewrite rules for a site hosted in a directory

I have a site that i am building in a directory, not in the root of my webserver.

I would like  http://localhost/mysite/index.php?view=home

to rewrite to http://localhost/mysite/home

I can't get it to work

trying this in .htaccess

RewriteEngine On
RewriteBase /mysite/
RewriteRule ^([^/]*)$ index.php?view=$1 [L]

I GOT IT!

RewriteEngine On
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?view=$1 [L]

many thanks to http://www.cheatography.com/davechild/cheat-sheets/mod-rewrite/

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM