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.

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 example.com/video/?p=2231&c=395840&s=849264&l=101641 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 example.com/video/string/string/?p=2231&c=395840&s=849264&l=101641 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
add comment

1 Answer

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 Jul 29 '10 at 8:59
add comment

Your Answer

 
discard

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