Jump to content

Recommended Posts

Hey everyone,

 

mod_rewrite is definitely something I am very weak with, so I'm hoping someone here can help me.

 

What I'm trying to do on my test site (test.site.com:81) is rewrite anything with a ?, so

http://test.site.com:81/?latest should rewrite to http://test.site.com:81/index.php?action=latest

 

I thought I had it working, but I don't get the correct rewrite and now I'm seeing error in my log for my /javascript directory, my /includes, my /images, etc, so I'm not sure if it's my programming or if it's my rewrite.

 

here is my current rewrite code:

RewriteEngine On
RewriteRule ^\?([^/]*)$ /index.php?action=$1 [L]

 

Any help would be greatly appreciated

 

RewriteRule doesn't look at the ? (or anything after). It only cares about the filename. You have to check the QUERY_STRING if you need it.

RewriteCond %{QUERY_STRING} ^(latest|other verbs)$
RewriteRule ^/?$ index.php?action=%1 [L]

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.