Forum Moderators: phranque
e.g. make-var1-details-var2.php
now the info on the above url can also be obtained from
make.php?Id=var1
this has been indexed by google 2 pages with diff urls.
How do i get rid of the unfriendly url using mod_rewrite.
i think i need it to point to a 404 is that right?
Thanx
More info here [webmasterworld.com].
Jim
You cannot 'create' information out of nothing, and as a result, what you seek to do is impossible unless the variable whose value is not present (in this case, "var2") can be given a fixed value.
Jim
Link 1 - make.php?Id=var1&Model=var2 (Unfriendly Url)
Link 2 - make-var1-details-var2.php (mod rewrite friendly url of Link 1)
Link 3 - make.php?Id=var1 ( Unwanted Url that is being crawled)
Ok Link 1 and 2 are ok and Link 1 has been redirected 301 to Link 2 which is the new friendly Url. Now link 3 is an url that is unwanted and is some how being indexed which i dont want.
How do i just stop link 3 being crawled and let the first 2 links do there jobs.
Thanx
RewriteCond %{query_STRING} &?Id=([^&]+) [NC]
RewriteRule ^Make\.php$ 404notfound.php? [NC,L]
Seems to work fine and show a 404 error as there is no such file called 404notfound.php. Is this the most efficient method in your eyes and thanx again for the help.
e.g. If Make.php?Id=var1 then 404 page not found
but if Make.php?blag=var2&Id=var1 then dont 404 but carry on as per usual.
So if Id variable comes directly after filename Make.php i need it to 404 otherwise dont. Hope this is possible. Thanx