Brandrally
Brandrally

Reputation: 849

.htaccess rewrite of 2 variables

I am working on some legacy code and running into a trouble in .htaccess that I cannot overcome.

Currently, if you enter in a browser:

/news/name-of-news-article.php 

the .htaccess file will call the database:

RewriteRule /news/(.*).php /pages/news.php?url=$1 [L]

and work just fine.

Trouble is, that I would like to include an optional variable in the url so that if I want to include an autoplay video - everything I try in the .htaccess to look for it, seems to kill the page and if I don't change the .htaccess it can't find the optional video=true.

/news/name-of-news-article.php?video=true

Upvotes: 0

Views: 72

Answers (1)

Haotian Liu
Haotian Liu

Reputation: 886

You should add QSA parameter to your rewrite rule.

RewriteRule /news/(.*).php /pages/news.php?url=$1 [QSA,L]

Upvotes: 2

Related Questions