mod_rewrite :: regex question
Posted: Wed Oct 25, 2006 11:41 pm
d11, your the token regex wizard
maybe you can help me?
I want it to:
1) Ignore 'page' and still output index.php?page=test
2) Ignore any extensions
My URL's should ideally look like:
But appear to scripts as:
I think I have to use %{HTTP_HOST} instead of page/ initially in the regex, but I don't know regex well enough...same goes for the allowing extensions...
By default when I enter (even using the page/document.html) a URL with an extension, mod_rewrite ignores the rules and Apache tries to retreive the file (due to the extension). This is undesired. As it stands right now I only have about 3-4 PHP files in the directory
Anyways, can anyone clear this up for me?
Cheers
Works awesome...but...RewriteEngine on
RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L]
I want it to:
1) Ignore 'page' and still output index.php?page=test
2) Ignore any extensions
My URL's should ideally look like:
Code: Select all
http://www.mydomain.com/submit.phpCode: Select all
http://www.mydomain.com/index.php?page=submit.phpBy default when I enter (even using the page/document.html) a URL with an extension, mod_rewrite ignores the rules and Apache tries to retreive the file (due to the extension). This is undesired. As it stands right now I only have about 3-4 PHP files in the directory
Anyways, can anyone clear this up for me?
Cheers