deansaddigh Posted June 19, 2009 Share Posted June 19, 2009 Hi guys, all i am trying to do is re-write my php pages to look like html pages. i found this code on the internet Options +FollowSymlinks RewriteEngine on RewriteRule ^(.*)\.htm$ $1.php [nc] i have enabled mod rewrite on my apache server. and saved the .htaccess file in the route of my site. It does absolutley nothing and my http://localhost/index.php stay as http://localhost/index.php ive attached an image to show that my .htaccess file is saved in route [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/ Share on other sites More sharing options...
RussellReal Posted June 19, 2009 Share Posted June 19, 2009 try going to index.html lol Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-859607 Share on other sites More sharing options...
deansaddigh Posted June 19, 2009 Author Share Posted June 19, 2009 Lol oopsy i tried going to http://localhost/index.html and i get a page not found error Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-859611 Share on other sites More sharing options...
RussellReal Posted June 19, 2009 Share Posted June 19, 2009 well, your rewrite should work with no problems, and you're not getting a 500 error (which is a way to tell if your htaccess is messed up), so have you restarted your server after you changed your apache configuration files? Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-859615 Share on other sites More sharing options...
deansaddigh Posted June 19, 2009 Author Share Posted June 19, 2009 thanks for the help, i restarted my apache server, i am using easy php which came with apache if that makes any difference. the link code im using is this <div id="toplinks"> <a href="../index.php">Home - </a> <a href="../userlogin.php">Login - </a> <a href="../Register.php">Register</a> </div> I dont know if that makes a difference. also i had to manual go into the C:\Program Files\EasyPHP 3.0\apache\conf file to enable the mod rewrite function. i dont know what else i should do Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-859619 Share on other sites More sharing options...
RussellReal Posted June 19, 2009 Share Posted June 19, 2009 I'm not sure how much I could help you, but I can point you in the right direction, there is a forum (right here on phpfreaks.com) its called Apache Installation or whatever, they're all more experienced with modding a server than I am, I simply use them Sorry I wasn't much help, wish you the best! Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-859622 Share on other sites More sharing options...
deansaddigh Posted June 19, 2009 Author Share Posted June 19, 2009 No problem i appreciate the help, ill head over there now. Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-859624 Share on other sites More sharing options...
popcornplya Posted June 19, 2009 Share Posted June 19, 2009 It should work, it's most likely your server. Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-859633 Share on other sites More sharing options...
deansaddigh Posted June 19, 2009 Author Share Posted June 19, 2009 Im using php my admin, which came with apache etc. im not sure if my .htaccess file is in the right place. Anyone that has used easy php please help. i cant seem to find an .htaccess file in the apache folder so i stuck it in the www folder where my website is saved. Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-859653 Share on other sites More sharing options...
thebadbad Posted June 19, 2009 Share Posted June 19, 2009 You realize that your pattern says .htm, right? Not .html as you said you tried. Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-859678 Share on other sites More sharing options...
Daniel0 Posted June 19, 2009 Share Posted June 19, 2009 You might also want to use the QSA flag to "transfer" the query string as well. Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-859679 Share on other sites More sharing options...
Daniel0 Posted June 19, 2009 Share Posted June 19, 2009 So something like this: RewriteRule ^(.*)\.html?$ $1.php [NC,QSA] That'll rewrite both .htm and .html to .php. Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-859680 Share on other sites More sharing options...
chmpdog Posted June 19, 2009 Share Posted June 19, 2009 change the flags and it should work [L, QSA] Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-859719 Share on other sites More sharing options...
deansaddigh Posted June 21, 2009 Author Share Posted June 21, 2009 Thanks very much it works now Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-860797 Share on other sites More sharing options...
chmpdog Posted June 22, 2009 Share Posted June 22, 2009 Any time Quote Link to comment https://forums.phpfreaks.com/topic/162917-solved-php-htacess-rewrites/#findComment-861017 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.