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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 {
} 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.