micmania1 Posted May 23, 2008 Share Posted May 23, 2008 Hi, I want to to use mod_rewrite (I think) on 1 file. I have a url http://www.domain.com/liveimage.php?image_id=123 and want it to appear as http://www.domain.com/liveimage/123.gif First of all can anybody helpt me out or point me to a good basic tutorial on how to do this? Secondly, to get my variables (image_id), will I need to parse the url or just use $_GET? Quote Link to comment https://forums.phpfreaks.com/topic/106913-solved-htdocs-mod_rewrite/ Share on other sites More sharing options...
DarkWater Posted May 23, 2008 Share Posted May 23, 2008 You can just you $_GET after you use mod_rewrite. And put this in the document root .htaccess file: RewriteEngine On RewriteRule ^liveimage/([0-9]+).gif$ liveimage.php?image_id=$1 RewriteRule ^liveimage/([0-9]+).gif/$ liveimage.php?image_id=$1 Quote Link to comment https://forums.phpfreaks.com/topic/106913-solved-htdocs-mod_rewrite/#findComment-547972 Share on other sites More sharing options...
micmania1 Posted May 23, 2008 Author Share Posted May 23, 2008 I am currently running on my computer. The domain is therefor curently http://localhost/sitename/ It is giving a 500 error message. The .htaccess file is in the sitenarectory and other directories are working fine. I'm using: Apache/2.2.8 (Win32) DAV/2 mod_ssl/2.2.8 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5 My webserver is linux. Quote Link to comment https://forums.phpfreaks.com/topic/106913-solved-htdocs-mod_rewrite/#findComment-547990 Share on other sites More sharing options...
wildteen88 Posted May 23, 2008 Share Posted May 23, 2008 Make sure the mod_rewrite module is loaded in your httpd.conf file. Quote Link to comment https://forums.phpfreaks.com/topic/106913-solved-htdocs-mod_rewrite/#findComment-548225 Share on other sites More sharing options...
micmania1 Posted May 23, 2008 Author Share Posted May 23, 2008 Yeah, its set. I'll check the .htaccess on my web server and get back to you. Quote Link to comment https://forums.phpfreaks.com/topic/106913-solved-htdocs-mod_rewrite/#findComment-548256 Share on other sites More sharing options...
micmania1 Posted May 23, 2008 Author Share Posted May 23, 2008 It works fine on my server. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/106913-solved-htdocs-mod_rewrite/#findComment-548264 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.