The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How can I install MOD_Rewrite?

Discussion in 'General Discussion' started by Servix, Jul 9, 2010.

  1. Servix

    Servix Registered

    Joined:
    Jul 9, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hey Guys!

    I am truely a noob when it comes to cPanel.. But. I am unsure about something..

    I need to be able to install/activate the MOD_REWRITE tool..
    Can anyone tell me how?
     
  2. WebScHoLaR

    WebScHoLaR Well-Known Member

    Joined:
    Dec 14, 2005
    Messages:
    511
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Planet Earth
    In cPanel environment, Apache includes mod_rewrite by default. So unless you have manually unselected it during Apache compilation, it should be installed already. If your server is running APache 2.x you can verify mod_rewrite as:

     
  3. linux7802

    linux7802 Well-Known Member

    Joined:
    Dec 14, 2007
    Messages:
    232
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    As per query its cleary showing that you are not sure about how REWRITE works. There for I would like to recommend you please first confirm if really REWRITE is disabled on your server or not. Let’s write a simple mod_rewrite example.Wwe’re just going to redirect people who ask for alex.html to the page gunjan.html page instead.First, let’s create the alex.html and gunjan.html pages. Below is alex.html webpage -

    <html>
    <head>
    <title>Alex webpage</titleA
    </head>
    <body>
    <p>
    This is Alex webpage
    </p>
    </body>
    </html>

    Create a similar one for gunjan.html

    <html>
    <head>
    <title>Gunjan webpage</title>
    </head>
    <body>
    <p>
    This is Gunjan webpage
    </p>
    </body>
    </html>

    Upload both of these to your web server, and check that you can view both of them. Now add following lines in .htaccess file. The .htaccess file is a text file which contains Apache directives. Any directives which you place in it will apply to the directory which the .htaccess file sits in, and any below it.

    RewriteEngine on
    RewriteRule ^alex.html$ gunjan.html

    And now browse following URLS

    http://yourdomain.com/alex.html
    and
    http://yourdomain.com/gunjan.html

    You see content of gunjan.html while browsing URL alex.html it means rewite is working on your server without any problem.
     
Loading...

Share This Page