mod_rewrite is not being enabled?

8,132

Redirect directive belongs to mod_alias, not mod_rewrite.

To test the mod_rewrite, put the belows in .htaccess file in document root:

RewriteEngine On
RewriteRule (.*) http://google.com [R=301,L]

Make sure that you set AllowOverride All in <Directory "/document/root">

Share:
8,132

Related videos on Youtube

Lynob
Author by

Lynob

Updated on September 18, 2022

Comments

  • Lynob
    Lynob over 1 year

    I have php 5.3.8, apache 2.2.21, all is good, except mod_rewrite

    by default LoadModule rewrite_module modules/mod_rewrite.so is enabled (not commented out)

    ClearModuleList does not exist

    AddModule mod_rewrite.c does not exist

    and then you have

    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    

    still i test mod_rewrite and it's not working, what more should i do?? if it wasn't for .htaccess i would have used nginx, by the way apache was installed by default when i got the vps and then i updated it but that didn't change the httpd.conf settings

    do you think i should uninstall it and reinstall it by myself??? everyone say that mod_rewrite should not be enabled by default so i don't know why my apache is different

    • user1233802
      user1233802 over 12 years
      This question should be on serverfault.
    • Lynob
      Lynob over 12 years
      @RaffaelLuthiger then please migrate it because i don't want to ask it twice and then be told that this is a duplicated question, it happened before :D
    • Admin
      Admin over 12 years
      do you have any aliases? remove.
    • Admin
      Admin over 12 years
      how did you test mod_rewrite? you need RewriteEngine On before RewriteRule in httpd.conf or .htaccess
    • Lynob
      Lynob over 12 years
      @mido i don't have aliases
    • Lynob
      Lynob over 12 years
      @cuttinger i tested my mod_rewrite like this Options +FollowSymLinks Redirect /google.html google.com
    • Lynob
      Lynob over 12 years
      i tested it using many ways, i get this error: the url requested was not found on the server
    • Lazy Badger
      Lazy Badger over 12 years
      redirect and rewrite are different topics
    • user1233802
      user1233802 over 12 years
      @Eli I do not have enough points to migrate it myself. I can only flag the questions. And that's what I did. I left this note to those who can migrate.
  • Lazy Badger
    Lazy Badger over 12 years
    302 responce, I suppose, is better in common
  • Lazy Badger
    Lazy Badger over 12 years
    Smth. like RewriteRule ^one.html$ two.html is slightly better for local tests