Jump to content

mod_rewrite passing filenames in root to a php variable


Gregor386
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...