Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

My current rewrite rules looks like:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond ${REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} ^/video/(.*)$
RewriteRule ^(.*)$ /video/index.php [L]

URL's like works fine.

For SEO reasons, I need to allow any string between video/ and ?p=2231&c=395840&s=849264&l=101641. For example, the URL should not map /string/string/ to index.php.

I tried the following rule, but it didn't work:

RewriteRule ^video/(.+)/(.+)/(.+)$ /video/$3 [L]

How should I solve this?

share|improve this question

If you only need Query String parameters, you can try this RewriteRule:

RewriteRule ^video(.*) /video/index.php [QSA,L]

QSA Flag will "forward" parameters to next script (ie index.php).

share|improve this answer
Well not only, coz video should be forward to index.php to. So if i type /video/string/string/?p=id index.php should get /video/?p=id without /string/string/. – lurtz Jul 28 '10 at 13:43
This rewrite will do that. But, user will still see first URL. If you need to explicitely redirect the user, change RR flags to [QSA,L,R=301] – Pierre-Yves Gillier Jul 29 '10 at 8:59

Your Answer


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