mjurmann Posted February 14, 2008 Share Posted February 14, 2008 Hello. Thanks to all the volunteers who give their time here. You guys are great. I have a question about mod_rewrite. In an effort to clean up my URLs, I've placed the following code in my .htaccess file in the root of my server: RewriteEngine On RewriteRule /features/(.*) htms/feature-page.php?id=$1 RewriteRule htms/google.html http://www.blah.com I know mod_rewrite is working because it successfully takes you to blah.com when you go to the page, htms/google.html. However, the URL is not being rewritten for the 2nd line of code (the line that really matters). Can someone tell me what I'm doing wrong? Thank you again. Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted February 14, 2008 Share Posted February 14, 2008 Well, obviously, the one that works has a preceding slash, you might try that. I'd probably do it like this RewriteRule ^/?htms/google.html$ http://www.blah.com [L,NS] but it's not tested. Basically, ^ is the start of the string, the slash with the trailing question mark makes it optional (just in case the slash isn't passed), it's got your stuff in the middle, and the end of string mark is $ Quote Link to comment Share on other sites More sharing options...
powerspike Posted February 15, 2008 Share Posted February 15, 2008 RewriteEngine On RewriteRule ^features/(.*)/$ htms/feature-page.php?id=$1 RewriteRule htms/google.html http://www.blah.com (please note, i always put a / on the end of sef url's - makes it look cleaner imo) Quote Link to comment 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.