Forum Moderators: phranque
php_flag output_buffering on
php_flag safe_mode off
php_flag register_argc_argv on
php_flag register_globals on
php_value session.gc_maxlifetime 14000
php_value max_execution_time 6000
php_value max_input_time 6000
php_value memory_limit 32MOptions +FollowSymLinks
RewriteEngine on
RewriteRule ^rss/new$ /rss.php?type=new [L]
RewriteRule ^rss/comments$ /rss.php?type=comments [L]
RewriteRule ^rss/views$ /rss.php?type=views [L]
RewriteRule ^view/(.*)/(.*)/ /staging/view_video.php?vid=$1 [L,QSA]
RewriteCond %{HTTP_REFERER}!^http://www.example.com [NC]
RewriteRule ^.*$ http://www.example.com/ [R,L]
RewriteRule \.(tpl)$ - [F,NC,L]
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
[edited by: engine at 10:05 am (utc) on Nov. 16, 2007]
[edit reason] examplified [/edit]
unfortunately the "dont seem to be working" part of your description doesn't give quite enough detail.
it would be much easier to figure out what is wrong if we knew what you tried to GET or POST and what your results were.
What I meant was that any RewriteRules from this .htaccess are not actually rewriting. For example:
RewriteRule ^rss/new$ /rss.php?type=new [L]
When I go to mywebsite.com/rss.php?type=new, everything works fine. When I try mywebsite.com/rss/new, I get a 404. The same for all rewrite rules in the .htaccess.
(Side question: If I make a change to .htacess, is it applied immediately? Or does apache need to restart for the changes to get applied?)
Thanks a lot for the help!
Look at your server error log, paying special attention to the filepath this requested URL was resolved to. If the filepath differs from that which you expected, use the mod_rewrite RewriteBase directive as needed to correct it.
Also be sure to completely flush your browser cache before testing any new code in httpd.conf, conf.d, or .htaccess -- Otherwise your browser will likely serve you a cached copy, and no request will be sent to your server (and this includes previously 404ed URLs).
[added] Side comment: Your fifth rule will break badly if an HTTP/1.0 client connects to your server. It will also break badly if even a legitimate visitor connects to your server through caching proxy, for example, all AOL users. This is because in both of these cases, an HTTP Referer header will not be sent to your server, and the result will be that a request for any object on your site will be redirected to the home page. I would recommend reconsidering both the purpose and the implementation of this rule. [/added]
Jim
[edited by: jdMorgan at 8:46 pm (utc) on Nov. 16, 2007]
What I see in my server error logs is:
[Fri Nov 16 16:48:54 2007] [error] [client 65.67.225.71] File does not exist: /home/viddpkcom/public_html/rss/views
(for the rule RewriteRule ^rss/views$ /rss.php?type=views [L])
I guess that means the URL rewriting isn't even happening, right?
Regarding the fifth rewrite rule, yeah...I'll probably just take it out.
Thanks again for looking at this!