[ NEED HELP ] REDIRECT CODE

lapan8

Newbie
Joined
Nov 3, 2023
Messages
18
Reaction score
3
Ask i mention in the title i need help to redirect url that have sign ? in the param.
The url with sign ? not considered as 404 so the url not get redirect but i'm afraid google will see that as duplicate content if get indexed.
Can someone in BHW tell me how to fix this?
 
You can use Yoast, it got an option to redirect such urls (any urls with php parameter) to their raw formats,
It could be found in the crawl optimization tab in the settings,

Other than that, you can either block crawling such URLs, set them as noindex or redirect them,
If you really need to redirect these, you can add the following code to your htaccess and it should do the work
Code:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\?([^\s]+)
RewriteRule ^(.*)$ /$1? [L,R=301]

In most cases, these won't be a problem anyway as the page got the right URL set for the canonical,
But, it could be used for some Chinese/Japanese spam mostly,
It all depends on what are these used for basically
 
Hello , for google redirect you can use only 301 method , you can use htaccess file to redirect or maybe you can use configuration on your ngnix if you are using ngnix , for sometime the htaccess not working fine you need to reload the configuration , but you can use this code :

creat file .htaccess on the main domain .

Redirect 301 / http://www.your-new-domaincom/
,


buy my friend hideath , i think he provide you the code working only GET requests , so if you change it to OPTIONS or POST or HEAD , i think i will be access to your old website and if your old website infected i can attack it and replace your redirection with my own .
 
Back
Top