Ruchika
Ruchika

Reputation: 515

htaccess remove string from url by 301 redirect

Need help to strip out this string from url

  index....</div></images/myblog_images/978

Incorrect URL

 http://www.abc.com/index....%3C/div%3E%3C/images/myblog_images/978/index.php?option=com_news&view=detail&n_id=20&Itemid=4

Correct URL

http://www.abc.com/index.php?option=com_news&view=detail&n_id=20&Itemid=4

Many thanks

Edit

Hello Anubhav While applying the htaccess condition - the url is been changed to

http://www.abc.com/home/truecar7/public_html/index.php?option=com_news&view=detail&n_id=20&Itemid=4

Upvotes: 1

Views: 144

Answers (1)

anubhava
anubhava

Reputation: 786091

You can try this code:

RewriteRule ^.+?(index\.php)$ /$1 [L,NC,R=301]

Upvotes: 1

Related Questions