Is this the way I'm supposed to be use mod_rewrite or do I have redundant lines?
Here's what I have:
<VirtualHost 127.0.0.1>
DocumentRoot D:\XAMPP\xampp\htdocs\mysites\tupega.com
ServerName tupega.tld
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/nuevoanuncio$ /create/nuevoanuncio.php
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/registrar$ /create/nuevousuario.php
</IfModule>
</VirtualHost>
Do开发者_StackOverflow社区 I have to create a new <IfModule>
for every rewrite I need?
No, you can put all your rules in one <IfModule>
block:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/nuevoanuncio$ /create/nuevoanuncio.php
RewriteRule ^/registrar$ /create/nuevousuario.php
</IfModule>
The <IfModule>
block is only used to avoid errors when mod_rewrite is not available.
精彩评论