Page 1 of 1

[TIP] Site crashes, error, etc after trying to implement mod_rewrite pretty URL

Posted: Sat Mar 27, 2010 2:28 am
by replytomk3
Can't believe I haven't seen this discussed before.

What happens if you try to implement mod_rewrite and your site stops working?

This is what happens. When you try to implement pretty URLs using mod_rewrite you naturally have to add things to .htaccess. That is where the problem comes from.

First of all, be aware of save errors when editing that file. If you try to edit the file using the File Manager from hosting, or by using the "edit" function of your FTP client (even Filezilla!), when you save that file errors will happen. New lines will not be handled properly. What you saw on screen is not what will be written to the file.

Also, and this is idiotic, you might not get a notification if you think you wrote to config.php, but it's file permissions do not allow writing to it.

Additionally, equally idiotic, is that EVEN A SINGLE CHARACTER OFF in the .htaccess file will always CRASH YOUR WEBSITE.

In particular, while it is suggested, the following lines

Code: Select all

Options +FollowSymLinks
Options -Indexes
ServerSignature Off
may or may not break your website.

Also,

Code: Select all

RewriteBase /
might have to be modified if you are not in the root of the server.

Re: [TIP] Site crashes, error, etc after trying to implement mod_rewrite pretty URL

Posted: Sat Mar 27, 2010 2:42 am
by replytomk3
Also, the following error can be displayed

Fatal error: Attempt to connect to database * on *  failed in */lib/adodb.functions.php on line 69

if the first few lines in .htaccess are messed with. Fe, if you had something like this before

Code: Select all

SetEnv PHP_VER 5
SetEnv REGISTER_GLOBALS 0
trying to edit this file in Notepad will make them into a single line like SetEnv PHP_VER 5SetEnv REGISTER_GLOBALS 0
and display the error above