Pritam Narkhede
Pritam Narkhede

Reputation: 163

Rewriting URL with query string question mark in htaccess file php

I have URL like www.yoursite.com/watch?v=OYQ3svsQ8Ys and want to redirect it to www.yoursite.com/index.php?v=OYQ3svsQ8Ys

Actually Question mark makes problem I am trying :

 <ifModule mod_expires.c>  
    Options +FollowSymLinks -MultiViews
    RewriteEngine On

    RewriteCond %{QUERY_STRING} ^v=([^&]+) [NC]
    RewriteRule ^watch$ index.php? [NC,L,QSA]
 </ifModule>

Upvotes: 0

Views: 462

Answers (1)

splash58
splash58

Reputation: 26153

The only error in your file is if content <ifModule mod_expires.c>. Change it to rewrite

<ifModule mod_rewrite.c>  
    Options +FollowSymLinks -MultiViews
    RewriteEngine On

    RewriteCond %{QUERY_STRING} ^v=([^&]+) [NC]
    RewriteRule ^watch$ index.php? [NC,L,QSA]
 </ifModule>

Upvotes: 1

Related Questions