I have a website developed in PHP. I have recently done the URL rewriting which works fine. However, I just found out that my pages with parameters are also accessible. For eg.

I converted this URL
domainname.com/index.php?page=product&pid=5&proTitle=Samsung Galaxy

After rewrite it looks like this
domainname.com/products/5/Samsung-Galaxy.html

Everything works just fine. However, My site is still accessible using the old parameters. I want if someone types in the old URL should be automatically redirected to Ideally New Page if not then index page. Google and MSN shouldn't access these pages with parameter. Any help will be highly appreciated.

show the rewrite code that you are using, to allow people to make the alteration,
it is often just enough to include a 301 permanently moved to the redirect
but nobody will be able to make a correct assessment without seeing what exists

no answer after 5 days, so a simple hint, is add the url parameters to your rewrite code
can't give an eact description of the changes to make, as I have not seen the code

Sorry I have been away and I appreciate your willingness to help me out. Here is what I am trying to achieve.

I converted this URL
domainname.com/index.php?page=product&pid=5&proTitle=Samsung Galaxy

After rewrite it looks like this
domainname.com/products/5/Samsung-Galaxy.html

The code looks like this.

RewriteRule ^products/(.*)/(.*).html$  index.php?page=product&pid=$1&proTitle=$2 [nc]

Rewrite Works fine. However, if I try to access old URL i.e domainname.com/index.php?page=product&pid=5&proTitle=Samsung Galaxy the page is still accessible and on top of that being crawled by Google and other search engines. I want If someone tries to access this URL, it should direct them to Page Not Found and this should also not be sniffed by any crawlers.

Thanks a lot again for your time and I hope I can get your valuable reply soon.

RewriteRule ^products/(.*)/(.*).html$  index.php?page=product&pid=$1&proTitle=$2 [R=301,L]

I thought it was old url new url, but if this is working as expected, ok,
html status 301 permanently moved
should make SEbots and others update their links, preserve rankings,
been a while since I had to change anything, but something like "mode_rewrite 301 moved" should give a shed load of google tutorials on the exact code

Be a part of the DaniWeb community

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