How To Troubleshoot mod_rewrite in Apache Linux Server Guide

Mobile
feeds
Welcome Login | Register


How To Troubleshoot mod_rewrite in Apache Linux Server Guide
How To Troubleshoot mod_rewrite in Apache Linux Server Guide This page contains information about How To Troubleshoot mod_rewrite in Apache Linux Server Guide Here you can also give your thought about the subject of How To Troubleshoot mod_rewrite in Apache Linux Server Guide


Main List


How To Troubleshoot mod_rewrite in Apache Linux Server Guide

By: Travis The Administrator

I was migrating a website from one server to another. When I uploaded all the files to the new server, the mod_rewrite was not working right. I was trying to mascarade my dynamic PHP urls into static urls as .html , but i kept getting a 404 error. I will help you troubleshoot if you are having the same fraustration as I was. Please note this troubleshooting guide tutorial works well and was tested with Linux Fedora Core 4, it may not be the same for other Linux Distributions.

First make sure you have done this:

How to Enable mod_rewrite in Apache Server [click on the link to see thread ]

after you have made sure that your apache mod_rewrite is enabled, do this:

[ WARNING: make a backup copy before you begin ]

1. open your httpd.conf file [ /etc/httpd/conf/httpd.conf ] if you dont know how to, executre this command in the shell: nano /etc/httpd/conf/httpd.conf

2. find and edit the following line in the httpd.conf file:

FROM:

 

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None


TO:

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride ALL

- Basicaly I am only changing "None" to "All" in the "AllowOveride"

- You can now edit the file with Linux nano editor, after you have edited hit control + x then it will ask you to save, say yes by typing the letter y then hit return. Next it will display the file name to confirm save as, in this case it will be httpd.conf, just hit return to save and go to next step

Step 3. After you have edited and saved the httpd.conf file, restart apache with this command:

/etc/init.d/httpd restart

step 4. After you have executed the above command, you will see httpd (apache) stop and then it will restart. it should give you an "OK" if you get a "FAIL", you have have done something wrong. If you are not sure what you did wrong, go back to the back-up file from from step 1 that you made before you began this troubleshooting guide. If you got OK, Congratulations! now test your mod_rewrite (.htaccess) and it should work. if it doesn't, you can post your trouble here to see if we can give you an answer.

Hope this helps


Posted on: May 08, 2006
Your Name
Your Email Address (Will Not Be Published)
Notify Me When Someone Replies to this Page
(An email will be sent to you when someone replies to your comments)
Your Comments
Include A Picture with your comments

# 129104 Reply By Geoff On Sun Feb 28, 2010 10:13 pm
Geoff
Reply
Thank you so much! Great post. This cleared my issue with Apache 2.2 on Win 7.

Peace,
Geoff
# 125486 Reply By Shane On Wed Jan 06, 2010 1:38 am
Shane
it certainly helped me! this resolved this issue for me. thanks for the post!
# 105154 Reply By Tuyen On Tue Jun 02, 2009 5:31 pm
Tuyen
thank you!
# 100105 Reply By Tuan On Sun Apr 12, 2009 7:02 am
Tuan
thank you.
# 92002 Reply By Rimian On Thu Jan 29, 2009 7:24 pm
Rimian
thanks! my sysadmin skills are ok at best. this got me out of some trouble as a deadline approached.