PDA

View Full Version : RewriteRule



lunetics
September 6th, 2007, 10:15 PM
Iīve a problem with rewrite rules in .htaccess. Can someone help me with the rewrite rules. The URL in the menu looks like this:
http://mydomain.com/articles
or
http://mydomain.com/about

The substitute would be index.php?page=ANYTHING
The rule: RewriteRule Pattern index.php?page=$1

The other URL is when looking at a specific article and look like this:
http://mydomain.com/articles/53

The Rule: RewriteRule Pattern index.php?page=article&id=$1
or
The Rule: RewriteRule Pattern index.php?page=$1&id=$2

simplistik
September 6th, 2007, 11:56 PM
:lol: what's the problem... you just answered your own question from what I can see...


RewriteRule ^(/)?$ index.php?page=$1[L, QSA]
RewriteRule ^article/([0-9])$ index.php?page=article&id=&2 [L, QSA]
RewriteRule ^([a-z])/([0-9])$ index.php?page=$1&id=&2 [L, QSA]

lunetics
September 7th, 2007, 07:00 AM
Well, almost :pleased:: I didnīt wrote the Pattern. I still get the "500 Internal Server Error". Right now, for testing, the local URL to the webpage is: http://localhost/mydomain.com/. So index.php is not in the www-root. Do I have to declare this in .htaccess?

Edit:
Now it works but I have to define all type of pages. The pattern ^([a-z]) or ^(/)?$ will not work but ^article/?$ or ^about/?$ works. Itīs OK but not as dynamically as it should be :(