Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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]
</IfModule>

It works perfectly, but Google is attempting to browse our URL and look for http://www.website.com.au/questions/1234/question-name when actually they're hosted at http://www.website.com.au/1234/question-name (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

 
discard

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

Browse other questions tagged or ask your own question.