I want to rewrite the url using .htaccess
Here is my main url which will be accessed by public:http://example.com/watch?v=123456789
I want same values of get parameters but in new location:
http://example.com/index.php?v=123456789
How can i do this? Help will be appreciated! Thanks.
Add a comment
|
1 Answer
it could be something like.. (.htaccess at root level)
RewriteRule ^watch/?$ index.php [QSA,L]
The important thing is the QSA option ("QueryString Append")
Hope it helps!
2 Comments
nachodd
@starkeen, I don't think that your correction is.. correct. Because the slash isn't provided in the original example (despite of the optional question mark).. At the most, it could be something like
RewriteRule ^watch(.php)?$ index.php [QSA,L]. Adding the slash would mean that watch could be a directoryAmit Verma
The slash is optional there so that the rule can accept both
/watch and /watch/ . Also if the watch is an existent dir then the rule won't match the pattern unless you spacify a traling slash to the directory path.