Forum Moderators: phranque

Message Too Old, No Replies

Yaswq

Yet another stupid rewrite question ....

         

the_nerd

9:04 am on Nov 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



this:

RewriteCond %{HTTP_HOST} ^www.mydomain.de [NC]
RewriteRule ^de/ger/([^/]*)\.htm¦html$ index.php?pagename=$1&domainid=3 [L]

should match (i.e. I think it should match)
de/ger/index.htm and
de/ger/index.html

what it does match is

de/ger/index.htm (good)
de/ger/index.htmwhydoesntthisrespectmyeoldollar (?)

doesn't the $ sign mean the rule should stop here?

chirp

9:57 am on Nov 8, 2005 (gmt 0)



Try this:

RewriteRule ^de/ger/([^/]*)\.(htm¦html)$ index.php?pagename=$1&domainid=3 [L]

or:

RewriteRule ^de/ger/([^/]*)\.html?$ index.php?pagename=$1&domainid=3 [L]

;)

the_nerd

10:48 am on Nov 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanks chirp!

does this (solution 1) mean alternatives have to be put between brackets, making them a back-reference?

nerd

chirp

1:42 pm on Nov 8, 2005 (gmt 0)



If you don't have the brackets then the 'alternative' is between 'm' and 'h' rather than between 'htm' and 'html'.

jdMorgan

3:32 pm on Nov 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The negative-match subpattern looks incorrect, since it's looking for "not a slash." I'd suggest it would be better to look for "not a period" (or "not a full stop" in .de terms):

RewriteRule ^de/ger/([^.]+)\.html?$ index.php?pagename=$1&domainid=3 [L]

The dollar sign says that the request you are matching with this pattern should stop there:

^abc = begins with abc
xyz$ = ends with xyz
^lmn$ = is exactly equal to lmn
^a.+z$ = starts with a, ends with z, and has at least one character between a and z.

See the short regex tutorial cited in our forum charter for more information on regular expressions.

Jim