Forum Moderators: phranque
I have a rewrite wich looks like this:
a)
RewriteCond %{REQUEST_URI}!^/(([a-zA-Z]+)[.]([a-zA-Z]+))
RewriteRule ^/(.*) [localhost:6080...] [L,P]
It does rewrite from Apache which works on :80 to Zope which works as localhost:6080
That's OK.
b)
RewriteCond %{REQUEST_URI} ^/(([a-zA-Z]+)[.]([a-zA-Z]+))
RewriteRule ^/([a-zA-Z]+)[.]([a-zA-Z]+) /s.php?n=$1.$2
This one catch a pattern smth like: [SERVER...] and passes this (Firstname.Lastname) to my PHP script (/s.php?n=$1.$2
)
Problem is: In zope I have *.css files which are not being rewrited because of the /Firstname.Lastname pattern.
Does anybody have a solution for this?
Thanx in advance.
RewriteEngine on
RewriteRule ^/([^.]+)\.([^/]+)/?$ /s.php?n=$1.$2
This will only match if the path starts with $foo.$bar, there are no '.' characters in $foo, no '/' characters in $bar, and the URL ends after $bar or $bar/
This will handle situations like:
But will not redirect, say, this:
This may or may not be what you're going for; you didn't mention if you needed to be able to support having URL path info after the name.
Does this help?
RewriteCond %{REQUEST_URI} ^!(.*)\.css
RewriteCond %{REQUEST_URI} ^/(([a-zA-Z]+)[.]([a-zA-Z]+))
RewriteRule ^/([a-zA-Z]+)[.]([a-zA-Z]+) /s.php?n=$1.$2 [L]
RewriteCond %{REQUEST_URI} ^(.*).css
RewriteRule ^(.*)\.css /path/to/$1.css [L]
Been up all night, so please forgive me if the syntax is not perfect, but I think you will get the point.
Remembered not to comment out this one...
Hope this helps.
Justin
just 20 minutes ago I've used this solution and it works:
RewriteCond %{REQUEST_URI}!^/(([a-zA-Z]+)[.]([a-zA-Z]+))
RewriteRule ^/(.*) [localhost:6080...] [L,P]
RewriteCond %{REQUEST_URI} ^/(([a-zA-Z]+)[.](css多tml夸pg夸peg在mp夙if))
RewriteRule ^/(.*) [localhost:6080...] [L,P]
RewriteCond %{REQUEST_URI}!^/(([a-zA-Z]+)[.]([a-zA-Z]+))
RewriteRule ^/(.*) [localhost:6080...] [L,P]
RewriteCond %{REQUEST_URI} ^/(([a-zA-Z]+)[.](css多tml夸pg夸peg在mp夙if))
RewriteRule ^/(.*) [localhost:6080...] [L,P]
#-------------------Catching / Vorname.Nachname---------
RewriteCond %{REQUEST_URI} ^/(([a-zA-Z]+)[.]([a-zA-Z]+))
RewriteCond %{REQUEST_URI}!^/(([a-zA-Z]+)[.](css多tml夸pg夸peg在mp夙if))
RewriteRule ^/([a-zA-Z]+)[.]([a-zA-Z]+) /s.php?n=$1.$2
In specially this line!^/(([a-zA-Z]+)[.](css多tml夸pg夸peg在mp夙if)) prevents not to catch.
Sorry for my english.. :(
RewriteCond %{REQUEST_URI} !^/(([a-zA-Z]+)[.]([a-zA-Z]+))
RewriteCond %{REQUEST_URI} !^/[a-z]+\.[a-z]+ [NC]