{"id":933,"date":"2010-02-05T13:02:19","date_gmt":"2010-02-05T18:02:19","guid":{"rendered":"http:\/\/bitpost.com\/news\/?p=933"},"modified":"2011-04-06T19:15:01","modified_gmt":"2011-04-07T00:15:01","slug":"troubleshooting-apache-mod_rewrite","status":"publish","type":"post","link":"https:\/\/bitpost.com\/news\/2010\/troubleshooting-apache-mod_rewrite\/","title":{"rendered":"Troubleshooting Apache mod_rewrite"},"content":{"rendered":"<p>mod_rewrite is essential if you&#8217;re going to write RESTful web services.  Here are the steps I went through to troubleshoot my installation:<\/p>\n<ol>\n<li>Ensure you included mod_rewrite in your apache installation.  For gentoo, you can use [eix www-servers\/apache] &#8211; Gentoo&#8217;s apache2_modules_rewrite flag is enabled for apache, looks good.<\/li>\n<li>Test to see if it is being loaded.  I created a dummy page phpinfo.php with the contents [&lt;?php phpinfo(); ?&gt;], to see what PHP had to say about it.  Search for mod_rewrite &#8211; yep, there it is, good.  If not, make sure it&#8217;s loaded in httpd.conf, the load line may be commented out.<\/li>\n<li>Now make sure it&#8217;s enabled for the path you&#8217;re using.  The apache directive is [RewriteEngine On], and it has to be somewhere in your httpd.conf or an included file.  In my case I use virtual hosts.  According to Apache docs, I needed to add both of these to the top level of my virtual host directive:\n<pre><code>RewriteEngine On\r\nRewriteOptions Inherit<\/code><\/pre>\n<\/li>\n<li>The mod_rewrite rules I&#8217;m dealing with are all in .htaccess files.  In that case you have to make sure you&#8217;ve turned on the switch that allows .htaccess files to override your settings.  Basically, you&#8217;ll need [AllowOverride All] enabled for the path where you want to use .htaccess files.<\/li>\n<li>Finally, make sure your .htaccess settings and rules look good.  Here&#8217;s an example I pulled from <a href=\"http:\/\/www.workingwith.me.uk\/articles\/scripting\/mod_rewrite\">another good troubleshooting blog entry<\/a>:\n<pre><code>cat .htaccess\r\n Options +FollowSymLinks\r\n RewriteEngine On\r\n RewriteRule ^alice.html$ bob.html\r\n RewriteRule ^bob.html$ alice.html<\/code><\/pre>\n<p>It should force bob&#8217;s page to load when you request alice&#8217;s, and vice versa.  Nice simple little test.<\/li>\n<\/ol>\n<p>Once I went through this list, I was good to go.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mod_rewrite is essential if you&#8217;re going to write RESTful web services. Here are the steps I went through to troubleshoot my installation: Ensure you included mod_rewrite in your apache installation. For gentoo, you can use [eix www-servers\/apache] &#8211; Gentoo&#8217;s apache2_modules_rewrite flag is enabled for apache, looks good. Test to see if it is being loaded. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[24,10,9],"tags":[67,76],"class_list":["post-933","post","type-post","status-publish","format-standard","hentry","category-php","category-tricks-tips-tools","category-websites","tag-apache","tag-mod_rewrite"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9M11L-f3","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/933","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/comments?post=933"}],"version-history":[{"count":6,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/933\/revisions"}],"predecessor-version":[{"id":1137,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/933\/revisions\/1137"}],"wp:attachment":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/media?parent=933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/categories?post=933"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/tags?post=933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}