Andy-H Posted February 10, 2010 Share Posted February 10, 2010 Can anyone help me with this, I am writing a website locally (WAMP) for my Dads decorating company and wish to rewrite the URLs to eliminate query strings, I have a folder in www called DadSite and am working off the .htaccess file in that folder (I have already loaded the rewrite module in apache and restarted all services) I wish to rewrite http://localhost/DadSite/index.php?page=(.*) to http://localhost/DadSite/$1 I.e A request to http://localhost/DadSite/Home will point to http://localhost/DadSite/index.php?page=Home But havent really used mod reqrite and wish for it to work when I transfer the site to a live server (probably shared host) in which the domain and public directory will be different. I have tried many variants but still cant get it to work. Options +FollowSymLinks RewriteEngine On RewriteRule index.php?page=(.*)$ $1 [NC,L] Thats my latest attempt, which resulted in failure lol Any help appreciated! Quote Link to comment Share on other sites More sharing options...
Andy-H Posted February 10, 2010 Author Share Posted February 10, 2010 Fixed it, just put a .htaccess file in the www directory with this. Options +FollowSymLinks RewriteEngine On RewriteRule ^(.*)$ DadSite/index.php?page=$1 [NC,L] Now http://localhost/Home maps to http://localhost/DadSite/index.php?page=Home Quote Link to comment Share on other sites More sharing options...
gizmola Posted February 10, 2010 Share Posted February 10, 2010 I don't follow you. The goal of "search engine friendly" url rewriting is to take a parameterized real url like: http://mysite.com/index.php?page=home and allow someone to instead use http://mysite.com/home/. In that case the rewrite rule will parse the last part of the url and turn that into the parameter to page=. Quote Link to comment Share on other sites More sharing options...
gizmola Posted February 10, 2010 Share Posted February 10, 2010 Ok, I see we were on the same page, your original description made it seem like you wanted the opposite. Glad you got it sorted out. Quote Link to comment Share on other sites More sharing options...
Andy-H Posted February 10, 2010 Author Share Posted February 10, 2010 Thanks, yeh my understanding of mod rewrite is not very good lol Sorry for causing confusion. 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.