Shortreminders
Shortreminders

Reputation: 13

removing url parameters from one url using .htaccess codes

I tried lot of combinations using available examples (.htaccess directives), but I couldn't able to achieve what I want. The problem is...

My actual URL is http://localhost/smon2/custsms/index.php?p_mob=9886419001

What I want is http://localhost/smon2/custsms/

Please help me in wrinting .htaccess code lines. Thanks

I tried with few of the items below...

RewriteEngine On  
RewriteCond %{QUERY_STRING} ^p_mob=1$
RewriteRule (.*) $1? [R=permanent]

RewriteEngine On  
RewriteCond %{QUERY_STRING} "p_mob=" [NC]
RewriteRule (.*)  /$1? [R=301,L]

RewriteEngine On  
RewriteRule ^/custsms/%{QUERY_STRING}/?$  http : //localhost/smon2/custsms/ [NC,L]

Nothing was working. please help.

Upvotes: 1

Views: 31

Answers (1)

anubhava
anubhava

Reputation: 784958

Replace all your current rules with this rule:

DirectoryIndex index.php
RewriteEngine On
RewriteBase /smon2/

RewriteCond %{QUERY_STRING} ^p_mob=\d+ [NC]
RewriteRule ^(custsms)/index\.php$ $1/? [R=301,L,NC]

Upvotes: 1

Related Questions