mod rewrite

Discussion in 'Apache' started by sudhakararaog, Jan 2, 2010.

  1. #1
    hi

    i am using a cms which requires mod_rewrite to be enabled for seo urls

    in the wamp that i use in my local machine in the httpd.conf file i have this line and removed the comment
    LoadModule rewrite_module modules/mod_rewrite.so

    when i view the phpinfo i can see that mod_rewrite is on in the Loaded Modules

    i am guessing that my hosting might not allow to edit the httpd.conf file so i tried adding the following to the .htaccess which is in the root directory

    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    and uploaded the .htaccess file and when i viewed the phpinfo i do not see mod_rewrite for my webserver

    also on my server i would be installing the cms in a separate folder after the root directory, so i guess the .htaccess file should be
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /foldername


    how do i go about enabling mod_rewrite in the .htaccess file as i might not be able to edit httpd.conf

    please advice.

    thanks
     
    sudhakararaog, Jan 2, 2010 IP
  2. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If the module is not loaded, you will need to load it. It really is that simple.

    Unfortunately for you, LoadModule does not work in .htaccess files. It must go in the httpd.conf.

    Contact your hosting provider and ask them to turn on mod_rewrite.
     
    Ladadadada, Jan 3, 2010 IP
  3. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #3
    Is

    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    all you added to .htaccess??? That alone won't do anything with making the URLs work. You also have to have for example

    RewriteRule ^blog/(.*)/(.*)/(.*)\.html$ blog.php?section=$1&id=$2&item=3 [L]
    RewriteRule ^blog/(.*)/(.*)\.html$ blog.php?section=$1&id=$2 [L]
    RewriteRule ^blog/(.*)\.html$ blog.php?section=$1 [L]

    To find out if you do have mod_rewrite working, try this simple test at domain.com/.htaccess.

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^wacko\.html$ index.php [L]

    With index.php being the actual index file name. Then go to domain.com/wacko.html

    If that URL shows the real file, you got mod_rewrite working.
     
    Nintendo, Jan 6, 2010 IP