Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:

Password:

Remember me

More rewriterules!
Welcome, Guest. Please login or register.
December 02, 2008, 07:14:14 AM
11304 Posts in 1248 Topics by 498 Members
Latest Member: katCheeme
Experts Round Table Network  |  Webservers  |  Apache  |  More rewriterules! « previous next »
Pages: [1]
Author Topic: More rewriterules!  (Read 554 times)
NeoTeq

Offline Offline

Posts: 21


« on: June 07, 2006, 05:00:18 AM »

I'm having a particularly lousy morning right now, because of something I can't explain. On my testserver, I have two directories. In the first directory, the rewriterule works, in the second it doesn't. Any ideas why?

=== dir1
= .htaccess
Code:
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)[/]?$ index.php?group=$1&page=$2 [L]


= index.php
Code:
...
$MenuGroupID = (isset($_GET["group"]) ? getCleanString($_GET["group"]) : 1);
$PageID = (isset($_GET["page"]) ? getCleanString($_GET["page"]) : 1);
...



=== dir2
= .htaccess
Code:
RewriteEngine On
RewriteRule ^([^/]*)[/]?$ index.php?page=$1 [L]


= index.php
Code:
...
echo $_GET["page"];
...


Note the 'getCleanString' function just cleans up my user/querystring input in the first, older example. The second example prints "index.php" when I go to http://testserver/dir2/test/ while i want it to return "test".
Logged

Still claiming: There is no peace.
NeoTeq

Offline Offline

Posts: 21


« Reply #1 on: June 07, 2006, 06:39:28 AM »

I feel silly...

Imagine somebody going to:

- http://someserver/articles/

Which gets redirected to:

- http://someserver/index.php?page=articles

Which again (since it matches the regex) gets redirected:

- http://someserver/index.php?page=index.php?page=articles

Nice recursion there ;)
Logged

Still claiming: There is no peace.
Pages: [1]
« previous next »
    Jump to: