How to check/enable mod_rewrite on Apache/Linux

13,714

mod_rewrite is already included in the httpd package, and is loaded in the default configuration. Use the RewriteEngine directive to enable it as required.

Share:
13,714

Related videos on Youtube

Yarin
Author by

Yarin

Updated on September 17, 2022

Comments

  • Yarin
    Yarin almost 2 years

    I can't get wordpress permalinks working on my Fedora LAMP server and expect it's due to mod_rewrite issue, but I can't figure out

    1. How do I check if mod_rewrite exists/is enabled?
    2. How do I install it (yum?) if it's not?

    Any help appreciated. Thanks-

    • stew
      stew over 13 years
      does "apachectl -l" list mod_rewrite.c ? if so, it was compiled in.
    • Yarin
      Yarin over 13 years
      @stew- no it doesn't. All it lists are core.c, prefork.c, http_core.c, and mod_so.c. So does that mean I have to recompile? That scares me- is there another way?
    • stew
      stew over 13 years
      no, it still can be added as a module, this just means it wasn't compiled in directly
  • stew
    stew over 13 years
    that would help with debian (and ubuntu and other derivatives) but not likely on fedora
  • Ignacio Vazquez-Abrams
    Ignacio Vazquez-Abrams over 13 years
    The best thing to do is to check the Context tag in the documentation. That will tell you where the directive can be used. httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriteengine
  • Yarin
    Yarin over 13 years
    @DerfK- It's fedora, and "LoadModule rewrite_module modules/mod_rewrite.so" already exists...
  • Yarin
    Yarin over 13 years
    Looks like mod_rewrite was indeed enabled, and I didn't need theRewriteEngine directive- Thanks for the help though-