Forum Moderators: phranque
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ page1.php?c=$1&cat_id=$2&cat_name=$3 [L] RewriteRule ^([^/]*)/([^/]*)\.html$ page2.php?id_sede=$1&nome_sede=$2 [L] Although viewing the url correctly written
define('WEB_ROOT', 'http://www.mysite.com/'); <?php echo WEB_ROOT . $var1."/".$var2; ?>.html"><?php echo $name; ?> RewriteRule ^([^/]+)/([^/]+)\.html$ page2.php?id_sede=$1&nome_sede=$2 [L] www.mysite.com/9/file-name.html When I click on the link, instead of
opening page2.php opens page1.php
but i can't use a / directory slash
Does the problem happen only when you clickI'm sorry but I do not understand, what does this mean? I'm newbie
on the link, or also when you type in the URL? What about typing
in some made-up garbage URLs that fit one of your two patterns?
The RewriteRule target path should have a leading slash.
I'm working on localhost with WAMP
I tried to enter a url like localhost/bla/im-newbie.html
and the result is always the same: page2.php
or since this is on a localhost (it sounds like) somehow the preceding / is present in the .htaccess file, unlike most situations
ExpiresActive On
ExpiresByType text/html "access" Not unless WAMP behaves differently from MAMP.
I also note with interest that internal requests resulting from mod_dir activity simply ignore all rules with the [R] flag-- something I'd stumbled across earlier in a different context, but now it comes into sharper focus.
Oxaguian, still with us?
^([^/]+)/([^/]+)/([^/]+)\.html$ page1.php?c=$1&cat_id=$2&cat_name=$3 [L] ^([^/]+)/([^/]+)\.html$ new-page.php?c=$1&ncat=$2 [L] ^([^/]+)/([^/]+)\.html$ new-page.php?c=$1&ncat=$2 [L] // works ^([^/]+)/([^/]+)\.html$ page2.php?id_sede=$1&nome_sede=$2 [L] // not works If you type in random URLs-- any old garbage, so long as it's got one or two directories and then a filename in html-- do you get redirected to the two different pages? Can you give me an example?
so these are the two rules:
^([^/]+)/([^/]+)\.html$ new-page.php?c=$1&ncat=$2 [L] // works
^([^/]+)/([^/]+)\.html$ page2.php?id_sede=$1&nome_sede=$2 [L] // not works
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)\.html /onepage.html [R=301,L]
RewriteRule ^([^/.]+)/([^/.]+)\.html /otherpage.html [R=301,L]