Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running a PHP web app that has a .htaccess file as below.

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]

It works perfectly, but Google is attempting to browse our URL and look for when actually they're hosted at (remove the /questions/)

What do I need to add to this .htaccess file to remove the /questions/?

I came up with this, but for some reason it's generating a 500 server error when I add it below RewriteRule and before </IfModule>

RewriteCond %{THE_REQUEST} ^GET\ /questions/
RewriteRule ^questions/(.*) /$1 [L,R=301]

Why are these two rules not working?

share|improve this question
Nevermind. My bad! Solved it. I'd post the solution to share for posterity but I don't have enough rep on the site to do it yet! Doh. :) – James Spittal Jun 7 '13 at 1:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.