Forum Moderators: phranque
I just wanted to throw in my 2 cents because I found a fix for my mod_rewrite godaddy problem. All I had to do was turn off multiviews and all my old mod_rewrite stuff worked again. Turn it off with this line in your .htaccess file:
Options -MultiViews
[edited by: jdMorgan at 4:03 pm (utc) on Dec. 16, 2007]
This is my htaccess, which works, BUT not on GoDaddy *(
AddDefaultCharset utf-8
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^main.php(.*)$ $0 [L]
RewriteRule ^more.html$ $0 [L]
RewriteRule ^images/(.*)$ $0 [L]
RewriteRule ^uimg/(.*)$ $0 [L]
RewriteRule ^style.css$ $0 [L]
RewriteRule ^favicon.ico$ $0 [L]
RewriteRule ^index.php(.*)$ $0 [L]
RewriteRule ^(.*)$ index.php [L]
How to make it work?
Because of this, we'll need some more information about what each rule is intended to do -- A good start would be to add comment lines above each rule to document for us and for yourself the intent of each rule.
Jim
## The main idea is to restrict (in url) all files from root directory, and allow only this:
RewriteRule ^main.php(.*)$ $0 [L]
RewriteRule ^more.html$ $0 [L]RewriteRule ^images/(.*)$ $0 [L]
RewriteRule ^uimg/(.*)$ $0 [L]
RewriteRule ^style.css$ $0 [L]
RewriteRule ^favicon.ico$ $0 [L]RewriteRule ^index.php(.*)$ $0 [L]
RewriteRule ^(.*)$ index.php [L]
[edited by: Wild_Striker at 12:20 pm (utc) on Dec. 19, 2007]
[edited by: jdMorgan at 12:59 am (utc) on Dec. 20, 2007]
[edit reason] Removed specifics per TOS. [/edit]
anyway, how should it be right? i don't understand *(
like I said, the main idea is to restrict all, and allow only:
main.php , more.html, style.css, favicon.ico
and all in derictories: images/ and uimg/
And there can be added befor and after index.php
Ser
By testing the code using the URL-paths matched in each rule on the working server, you may be able to discern how it works. It is possible that many of the rewrites to $0 are actually intended to exclude those URL-paths from being rewritten by the last rule. But again it is hard to tell, since $0 is undefined by the mod_rewrite documentation, and --as your experience shows-- may give different results on different OS and Apache version installations.
Jim