Article ID: 129296, created on Aug 22, 2016, last review on Aug 22, 2016

  • Applies to:
  • Operations Automation

Question

How to check if mod_rewrite is enabled on customer's website?

Answer

  1. Check the following module on the corresponding Web Server in the list of Apache modules:

    # httpd -M | grep rewrite
    Syntax OK
    rewrite_module (shared)
    
  2. Check that this module is enabled via phpinfo page for this domain. Create phpinfo.php file with the following content in the root directory of the webste:

    <?php
    phpinfo();
    ?>
    

    Access http://example.com/phpinfo.php and make sure that MOD_REWRITE module is shown as 'enabled'.

  3. Modify .htaccess file to enable mod_rewrite for a single website:

    <IfModule mod_rewrite.c>
    #check if mod rewrite is enabled
    SetEnv MOD_REWRITE enabled
    
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    

    The above .htaccess file (if placed in the DocumentRoot) will redirect all traffic to the index.php file of the website root directory.

  4. Create the following files to test mod_rewrite module:

    # cat /var/www/vhosts/example.com/test_rewrite/.htaccess
    RewriteEngine On
    RewriteRule ^.*$ mod_rewrite.php
    
    # cat /var/www/vhosts/example.com/test_rewrite/mod_rewrite.php
    <?php echo "Mod_rewrite is activated!"; ?>
    

    and access the url http://example.com/test_rewrite/

Search Words

server info

Need to set ReWrite Engine On

.htaccess not working

how to set rewriteengine on plesk

Customer can't enable mod_rewrite

mod_rewrite

5356b422f65bdad1c3e9edca5d74a1ae caea8340e2d186a540518d08602aa065 e12cea1d47a3125d335d68e6d4e15e07

Email subscription for changes to this article
Save as PDF