1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Apache profile with mod_rewrite?

Discussion in 'BlackHat Lounge' started by Roparadise, Nov 25, 2012.

  1. Roparadise

    Roparadise BANNED BANNED

    Joined:
    May 25, 2011
    Messages:
    786
    Likes Received:
    1,417
    Does anyone know where someone can download an apache profile with mod_rewrite enabled or at least installed? I've noticed its a common issue to not have it either installed or enabled, and I don't see it as an optional module in easyapache when I try to build a profile.
     
  2. Roparadise

    Roparadise BANNED BANNED

    Joined:
    May 25, 2011
    Messages:
    786
    Likes Received:
    1,417
    Im currently using centos 6 if I reinstall my VPS to have ubuntu will it be easier to have mod_rewrite module installed? This problem has been driving my crazy for the past few days.I've been reading about it and it seems like a very common issue but there is no clear guide on getting apache with mod_rewrite module installed. Every guide I've seen so far assumes you have the module but have AllowOverride set to None instead of All.
     
    Last edited: Nov 25, 2012
  3. MrBlue

    MrBlue Senior Member

    Joined:
    Dec 18, 2009
    Messages:
    950
    Likes Received:
    662
    Occupation:
    Web/Bot Developer
    Installing mod_rewrite on Apache is pretty simple. You don't need to download anything.

    1. Open the Apache configuration file located at /etc/httpd/conf/httpd.conf
    2. Change AllowOverride None to AllowOverride All inside the DocumentRoot Directory Directive, normally <Directory "/var/www/html">
    3. Restart Apache: service httpd restart

    More info here:
    Code:
    http://dev.antoinesolutions.com/apache-server/mod_rewrite
     
    Last edited: Nov 25, 2012
  4. themidiman

    themidiman Power Member

    Joined:
    Feb 25, 2011
    Messages:
    701
    Likes Received:
    1,534
    Location:
    root@pts/0
    What version of apache are you running? I thought mod_rewrite was installed by default with the latest versions.
     
  5. sam0016

    sam0016 Registered Member

    Joined:
    Feb 7, 2012
    Messages:
    78
    Likes Received:
    15
    Don't forget to change AllowOverride none to AllowOverride All in the <Directory "/usr/local/www/apache22/data"> part of the httpd.conf I think it is <Directory "/var/www/html"> on centOS I use FreeBSD so I am used to a different default.

    Edit: Sorry I didn't see someone else had posted this.
     
    Last edited: Nov 26, 2012
  6. Roparadise

    Roparadise BANNED BANNED

    Joined:
    May 25, 2011
    Messages:
    786
    Likes Received:
    1,417
    @Mrblue I did everything you said already,and even rebooted my VPS,but I still have the 404 error caused by mod_rewrite module not being there

    I have Apache/2.2.23
     
  7. sam0016

    sam0016 Registered Member

    Joined:
    Feb 7, 2012
    Messages:
    78
    Likes Received:
    15
    Are you sure LoadModule rewrite_module libexec/apache22/mod_rewrite.so is not commented out? Also you get a 502 if AllowOverride none is not AllowOverride All post your httpd.conf here and I will have a look. Also I don't think Ubuntu will make it any easier it probably dose what Debian dose and changes the default config files all about and it just makes it harder to find the part you need to change that's from my experience though.
     
    Last edited: Nov 26, 2012
  8. Roparadise

    Roparadise BANNED BANNED

    Joined:
    May 25, 2011
    Messages:
    786
    Likes Received:
    1,417
    Here is whats in my http.conf file http://www.sendspace.com/file/rp9wyd
     
  9. keinehabe

    keinehabe Supreme Member

    Joined:
    Nov 4, 2008
    Messages:
    1,207
    Likes Received:
    472
    Gender:
    Male
    Occupation:
    -= CEO =-
    Location:
    Heaven
    Home Page:
    when you install your vps ( OS ) ... you have to install the apache deamon , after apache is installed and you setup to autostart on boot .
    install php :
    Just copy and paste this :)
    after all dependencies are installed :
    cd /ect/httpd/conf/httpd.conf
    and edit AllowOverride None with All ( from directory )
    Or .. when you setup your vhosts.conf you can rewrite it there like :
    ps. remember vhost.conf is on /etc/httpd/conf.d
    Obviously you have to actually write your domain name instead of the example one lol :)

    Btw , mod_rewrite is installed and active on default install BUT it's need to be active at folder lever ( it's like a switch button lol if you wanna say so ) .
    Ps2. mkdir /home/yourdomainname.com (* for creating the folder where you will host site files .
    chown -R apache:apache /home/yourdomainname.com (* allowing to apache to actually write and execute files in site folder )
    chmod 755 /home/yourdomainname.com (* your best bet will be to chmod the folder lol )
     
    Last edited: Nov 26, 2012
  10. Roparadise

    Roparadise BANNED BANNED

    Joined:
    May 25, 2011
    Messages:
    786
    Likes Received:
    1,417
    I already installed apache in whm several times with different builds they offer,but it still gets my a 404 on my site.
     
  11. keinehabe

    keinehabe Supreme Member

    Joined:
    Nov 4, 2008
    Messages:
    1,207
    Likes Received:
    472
    Gender:
    Male
    Occupation:
    -= CEO =-
    Location:
    Heaven
    Home Page:
    why on name of god do you need to mess with manual install then if you use whm ?:)
    second question why on name of god do you really need the whm afterall :)
    Ps. those recommendations are for installing the php & apache without any crappy control panel and so ... plain and simple unix/linux lol .

    If you still wanna use whm and cpanel , you have to not mess with the easyapache crappy toy :)
     
  12. sam0016

    sam0016 Registered Member

    Joined:
    Feb 7, 2012
    Messages:
    78
    Likes Received:
    15
    That is not the default httpd.conf try this.

    http://www.sendspace.com/file/s059cb

    If that dose not work post these 2 include files mod rewrite was not loaded in there all I did was add it in I am not sure what the other files have in them I am used to the default httpd.conf lol. Also make sure apache is listening on the right port/ip somewhere in one of the config files it has Listen 127.0.0.1:80 change the local ip to your server's ip by default it is in the httpd.conf but it is not in your config.

    Include "/usr/local/apache/conf/includes/pre_main_global.conf"
    Include "/usr/local/apache/conf/includes/pre_main_2.conf"

    They are the 2 files I need to see.

    I never use a cpanel I think they are a waste of time to setup its just a waste of ram on the vps but some people want to use them. I guess they don't like using command line or are scared of it. I think they just have loads of useless things in them that you could get in other places like emails in cpanel you can get email hosting all over the place and stats tracking you can use clicky what else can you do in cpanel that you use?

    Edit: I am tired sorry if there is a lot of typos or I missed anything.

    Edit: This might sound like a dumb question but I just want to check you are restarting apache after you make changes to the config? if not changes wont take effect on centOS you can do this with the command service httpd restart.
     
    Last edited: Nov 26, 2012
  13. Roparadise

    Roparadise BANNED BANNED

    Joined:
    May 25, 2011
    Messages:
    786
    Likes Received:
    1,417
    I finally was able to get it solved, I had to command line install the php,mysql and apache with a fresh OS install,then do the enabling steps.
     
  14. sam0016

    sam0016 Registered Member

    Joined:
    Feb 7, 2012
    Messages:
    78
    Likes Received:
    15
    Good job it is always much better to get it done your self then have people help you so you no what to do next time.
     
  15. Roparadise

    Roparadise BANNED BANNED

    Joined:
    May 25, 2011
    Messages:
    786
    Likes Received:
    1,417
    Its crazy that the whm didnt install Apache to include the module,when the issue of mod_rewrite not being installed has been going on for nearly a decade and with lots of people going crazy over it.