Jump to content

[SOLVED] index.php?get=resource Force redirect to /resource


Recommended Posts

Alright Im not to sure if this is more of a rewrite issue or a PHP issue. I have seen this with different rewrite addons for SMF and other projects.

 

I have

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?action=$1 [L,QSA]

Now it works when I goto /resource as it shows index.php?action=resource. But I am wondering how to force anyone that goes to index.php?action=resource to be redirected to /resource.

 

Im not sure if this can be accomplished with rewrite, but if so that would be awesome.

 

Thanks in advance,

-nonexistentera

Well the main problem that I am getting with that is a never-ending loop. index.php?action=resource is equal so it will redirect to /resource. But action is still equal to resource so it will redirect again, just continuing.

Im not sure what to do but I am going to go over some modules that have worked and see what makes them tick. XD

Finally got it. You can close this topic

 

I decided to use the requested URI, then this doesn't create an endless lood, as once it gets to the 'pretty' page, it stops

$text = $_SERVER['REQUEST_URI'];
if (preg_match("/\baction=\b/i", $text)) {
header('Location: http://www.x00n.com/' . $_GET['action']);
} else {
} 

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.