mdmartiny Posted September 21, 2012 Share Posted September 21, 2012 I have a shortner website that I am working on. Just a little project that I am doing in hopes that i can learn better. Anyways my issue is that the shortened links are not working like they should. Actually they are not working at all. I keep getting a 404 page. When I do something like shortit.org/123456 I get the 404 page. shortit.org is the site that I am working on. Here is the redirect code <?php include('function/init.php'); if(isset($_GET['code']) && !empty($_GET['code'])) { $code = $_GET['code']; redirect($code); die(); } ?> here is the redirect function function redirect($code){ $code = mysql_real_escape_string($code); if(code_exists($code)){ $url_query = mysql_query("SELECT `url` FROM `urls` WHERE `code` = '$code'") or die (mysql_error()); $url = mysql_result($url_query, 0 , 'url'); header('Location:' . $url); } } here is my .htaccess RewriteEngine on RewriteRule ^([a-zA-Z0-9]+)$ index.php?code=$1 Link to comment https://forums.phpfreaks.com/topic/268634-htaccess-redirect-not-working/ Share on other sites More sharing options...
requinix Posted September 21, 2012 Share Posted September 21, 2012 Put random garbage in the .htaccess and browse your site. Do you get 500 errors on every page? Link to comment https://forums.phpfreaks.com/topic/268634-htaccess-redirect-not-working/#findComment-1379812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.