mcc_22ri Posted May 26, 2012 Share Posted May 26, 2012 Hi Everyone, I'm getting an internal server error when I add the .htaccess file. When I delete the file from my folder the URLS are working but when I add it I'm getting the below error. I'm attempting to rewrite my URLS. I'm trying to make them more SEO friendly. I'm trying to append the $city name from my MySql database onto my URL. Below is the error code and syntax for my pages. (I uploaded the .htaccess so you can view the error code) Error code Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@whatsmyowncarworth.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache Server at whatsmyowncarworth.com Port 80 As of right now I'm attempting to echo $city; to see if my coding is working but I wasn't expecting a internal servor problem. Any thoughts? Thanks for everyones help! http://whatsmyowncarworth.com/auto/cars.php http://whatsmyowncarworth.com/auto/Albany <<--- I'm trying to append city names within my URLS http://whatsmyowncarworth.com/auto/Boston http://whatsmyowncarworth.com/auto/Massachusetts cars.php <?php ob_start(); // handle redirects include('init.php'); // connection to database if (isset($_GET['u'])) { $city = mysql_real_escape_string($_GET['u']); if (ctype_alnum($city)) // protection against mysql injection { $data + mysql_query("SELECT State, City FROM cars WHERE City='$City'" ); if (mysql_num_rows($data===1)) { echo $city; } } } ?> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> .htaccess file RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f [OR] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . * - [L] RewriteRule ^(.*)$ http://whatsmyowncarworth.com/auto/cars.php?u=$1 [NC] Quote Link to comment https://forums.phpfreaks.com/topic/263175-rewrite-urls-but-htaccess-is-giving-me-trouble-not-sure-why/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.