1

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?

Lekensteyn
  • 6,241
  • 6
  • 39
  • 55

1 Answers1

0

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).

  • 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/. –  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 08:59