Jump to content

mod_rewrite passing filenames in root to a php variable


Gregor386

Recommended Posts

I've been trying to get this working for a while now, but cant:Sdomain.com/ = test.phpdomain.com/name = test.php?p=namedomain.com/othername = test.php?p=othernamedomain.com/directory/ = domain.com/directorydomain.com/img/myres.png = domain.com/img/myres.pngdomain.com/css/myres.css = domain.com/css/myres.cssEverything I try gives me a server error (RewriteRule (.*)$ test.php?p=$1), but if I use something like (RewriteRule ^p=(.*)$ test.php?p=$1) it works.I also tried variations of RewriteCond, but /sth is not threated nor as a directory (-d) nor as a file (-f) it just tries to acces /sth on my serverI'm really loosing it here, any tip would be apprechiated!Gregor

Link to comment
Share on other sites

What rules are you using now?
RewriteRule ^page/(.*)$ /test.php?p=$1RewriteCond %{REQUEST_FILENAME} -dRewriteRule (.*)$ /test.phpI tried many variations ofRewriteRule ^(.*)$ /test.php?p=$1alsoRewriteRule (.*)$ /test.php?p=%{REQUEST_URI}I am trully lost and cant wrap my head around how mod_rewrite does this:S
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...