Jump to content

Recommended Posts

Hi,

 

Apache user newbie here.

I need help, how do i enable mod_rewrite in my apache?

what are the codes or lines that i should have in

my httpd.conf file?

 

also, what are the other files that i need to modify and things, testing to do to

make it and know that its already working?

 

hope you could help me with this.

 

thanks so much!!!!

Link to comment
https://forums.phpfreaks.com/topic/52834-help-on-enabling-mod_rewrite-in-apache/
Share on other sites

to enable mod_rewrite edit the the httpd.conf file and find this line:

#LoadModule rewrite_module modules/mod_rewrite.so

Change it to this:

LoadModule rewrite_module modules/mod_rewrite.so

 

Also scroll down to around line 200 and make sure AllowOverride directive has FileInfo listed.

 

Save the httpd.conf file and restart Apache. mod_rewrite should now be available

What OS are you using? Windows Mac/Linux.

 

If its Windows just right click the Apache task bar icon and click restart from the context menu. If your new configuration works it should restart with no errors/error sounds during restart.

 

For restarting Apache under Mac/Linux please read this page of the Apache Manual.

 

To test mod_rewrite works just create a simple test file, call it modTest.html and put some random stuff in there. Then create a new fill called ".htaccess" (minus the quotes). Then add this in it:

RewriteEngine On
RewriteRule ^mod_rewrite_test/$ modTest.html

 

Place that file in that same directory as modTest.html now go to http://my-domain.com/mod_rewrite_test/

 

It should now show the contents of modTest.html

Hi i am using linux.

 

 

also i went to my httpd.conf file

the configuration says that its something like vhost.

 

also i cannot find this line

#LoadModule rewrite_module modules/mod_rewrite.so

and this line also

AllowOverride

if thats the case should i just add this

LoadModule rewrite_module modules/mod_rewrite.so

and this

AllowOverride

 

help on this please.

 

thanks!

Apache on linux does things much more on a modular basis.

 

All available modules (ssl, mod_rewrite) etc. are stored in:

/etc/apache2/mods-available

 

all enabled apache modules are linked from above and placed in:

/etc/apache2/mods-enabled

 

To enable a module, simply type (in a shell terminal):

a2enmod

and select your module from the list.

 

To restart apache on linux:

/etc/init.d/apache2 restart

 

Take a read of http://wiki.kartbuilding.net/index.php/Apache_2_%26_SSL_-_PHP4_-_MySQL_4.1

 

If you are having problems with the above, you will need to supply your linux os, whether its ubuntu, fedora etc.

 

-steve

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.