Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How to write RewriteRule in .htaccess file?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #41920
    sayedtaqui
    Member

    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…

    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]

    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]

    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

    #125774
    SgtLegend
    Member

    What happens when you try to use the rewrite rule? Does it 404?

    #125776
    sayedtaqui
    Member

    It doesn’t show any errror.
    But when I replaced a letter ‘m’ from the word +FollowSymLinks to +FollowSynLinks(just to check weather its even doing something or not.) , it showed error 500, thats the only error I have seen, else it doesn’t show any error.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.