Jump to content

Mod Rewrite Question? .htaccess


scm22ri

Recommended Posts

Hi Everyone,

 

I've figured out how to re write a url correctly to my website. The problem is no content is showing on the page.

 

I want to take the below URL

http://whatsmyowncar...te=rhode island

 

and turn it into this one (I think I've accomplish that but on the below URL, the page is showing no data). I figred my .htacess was a bit off but I'm not sure how. What am I doing wrong here?

http://whatsmyowncar...om/rhode-island

 

 

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)$ /state.php?s=&u=$1 [L,NC]

Link to comment
Share on other sites

Post the query for that page.  Also, show how you're dealing with the url parameters 's' and 'u'.

 

I'm guessing that your query is something like the following:

 

$state = $_GET['state']; // rhode island
$sql = "SELECT * FROM `table` WHERE `state` = '". $state ."'";

 

But now, because of the rewrite, the state is hyphenated and the query is failing.

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.