Hi, I have created a cms on my localhost for a website. And I have created only one page where I am dynamically creating all other pages by passing different ids. So my pages are like this. http://localhost/spscollege/allpages.php?id=1 for about-us http://localhost/spscollege/allpages.php?id=2 for facilites http://localhost/spscollege/allpages.php?id=3 for addmission and so on... Code (markup): I want to rewrite the rule for the url in .htaccess , and I googled it a lot but nothing seems to work. Let me tell you what all things I did so you can figure out what mistake i m making. 1- I created a .htaccess file and kept in the root directory of my folder(along with allpages.php) 2. I wrote (from a turtorial) this in the .htaccess file Options +FollowSymLinks RewriteEngine On RewriteRule ^home.*$ http://localhost/spscollege/allpages.php?id=1/ [R=301,L] Code (markup): I also checked the configration in phpinfo() and I can see that mod_rewrite is on. I also used http://www.generateit.net/mod-rewrite/ to rewite which gave me this RewriteEngine On RewriteRule ^([^/]*)\.html$ /spscollege/allpages.php?id=$1 [L] Code (markup): but that didn't work either I watched a lot of youtube vidoes but nothing seems to be working for me. What mistake m I making? and how do get this work . ): I m using Xampp I have never written the rewrite rule before, I would apperecite any help or suggestion. Thanks
It's very simply. try this: RewriteEngine On RewriteRule ^about_us\.html$ allpages.php?id=1 [L] RewriteRule ^facilities\.html$ allpages.php?id=2 [L] RewriteRule ^admission\.html$ allpages.php?id=3 [L] It will work both on your server and locally.