How to use mode_rewrite function
I'd like to know, how I can use php's function mode_rewrite correctly.
I'm currently developing with xampp. I've activated LoadModule rewrite_module modules/mod_rewrite.so in the httpd.conf file.
Also I edited following lines:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
In my .htaccess file, I've following code:
RewriteEngine On
RewriteRule ^([^/]*)\.html$ /?m=$1 [L]
So it should change ?m=start to ?start.html.
When I now open localhost/page/start.html, it only shows me "It works". But why doesn't it show me the content from localhost/pag开发者_运维技巧e/?m=start ?
A further question would be, how do I change the rewrite rule, that I could access localhost/page/?m=start&set=update through localhost/page/start/update.html?
Thank you for an answer!
You are using the absolute path / in your substitution. So when using this rule in the .htaccess file in /page/ a request of /page/start.html will actually be rewritten to /?m=start and not /page/?m=start.
Try a relative path instead:
RewriteRule ^([^/]*)\.html$ ./?m=$1 [L]
加载中,请稍侯......
精彩评论