Hi guys !

I am using rewriting rules to redirect some URLs, but search engines crawling both URL (Rewritten and Real URLs).

For example :

Real URL : www.catchcoupons.in/storecoupon.php?cid=Flipkart

Rewritten URL : www.catchcoupons.in/coupon/Flipkart.html

Search Engines are crawling both URLs, even i want search engines to index only Rewritten URLs (http://www.catchcoupons.in/coupon/Flipkart.html)

This is happening with all the URLs...

Below are the codes that i am using on my .htaccess file :

Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteRule index.html$ index.php [NC,QSA,L]
RewriteRule allstore.html$ allstore.php [NC,QSA,L]
RewriteRule printable.html$ printable.php [NC,QSA,L]
RewriteRule coupon/([a-zA-Z0-9_-]+).html$ storecoupon.php?cid=$1 [NC,QSA,L]
RewriteRule category/([a-zA-Z0-9_-]+).html$ categorystore.php?cid=$1 [NC,QSA,L]
RewriteRule pages/([a-zA-Z0-9_-]+).html$ cms.php?id=$1 [NC,QSA,L]

RewriteRule print/([a-zA-Z0-9_-]+).html$ printcoupon.php?cid=$1 [NC,QSA,L]
RewriteRule newsletter.html$ newsletter.php [NC,QSA,L]
RewriteRule newslettererror.html$ newslettererror.php [NC,QSA,L]

RewriteRule offers/([a-zA-Z0-9_-]+).html$ detail-page.php?cid=$1 [NC,QSA,L]
RewriteRule submit.html$ submit.php [NC,QSA,L]
RewriteRule contactus.html$ contactus.php [NC,QSA,L]
RewriteRule List-Your-Business-On-CatchCoupon.html$ List-Your-Business-On-CatchCoupon.php [NC,QSA,L]
RewriteRule sitemap.xml$ sitemap.php [NC,QSA,L]
RewriteRule listing/([a-zA-Z0-9_-]+).html$ comment.php?id=$1 [NC,QSA,L]
Re: .htaccess file failed to rewrite URLs 80 80

I believe you are missing a caret(^) sign in your rule

RewriteRule ^products/([0-9]+)/?$ show_a_product.php?product_id=$1

Re: .htaccess file failed to rewrite URLs 80 80

Ya tried it but did not work...
I have this rule :
RewriteRule ^category/([a-zA-Z0-9_-]+).html$ categorystore.php?cid=$1 [NC,QSA,L]

but still both URLs are accessable :

http://www.catchcoupons.in/categorystore.php?cid=Mobiles-and-Tablets

AND

http://www.catchcoupons.in/category/Mobiles-and-Tablets.html

I want permanent redirection to :

http://www.catchcoupons.in/category/Mobiles-and-Tablets.html

Re: .htaccess file failed to rewrite URLs 80 80
Member Avatar

They will be because you're not providing a redirection just a rewrite. Use the 'R' flag to redirect. There are other ways e.g.

Redirect 301 /originallocation.php /newlocation.php
Re: .htaccess file failed to rewrite URLs 80 80

Did as you said added R flag:
RewriteRule category/([a-zA-Z0-9_-]+).html$ categorystore.php?cid=$1 [NC,QSA,L,R]

But still not redirectng, both URL are accessable.

Re: .htaccess file failed to rewrite URLs 80 80

Did as you said added R flag:
RewriteRule category/([a-zA-Z0-9_-]+).html$ categorystore.php?cid=$1 [NC,QSA,L,R]

But still not redirectng, both URL are accessable.
http://www.catchcoupons.in/categorystore.php?cid=Mobiles-and-Tablets

And

http://www.catchcoupons.in/category/Mobiles-and-Tablets.html

Re: .htaccess file failed to rewrite URLs 80 80
Member Avatar
Re: .htaccess file failed to rewrite URLs 80 80

Admin,

Please remove all the url from this post pointing to Catchcopons, we are gtting lots of hit to my site from this post.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.