1
votes

Is possible ignore a 301 Moved Permanently redirect and get contents of original webpage. Example: I have a domain1.xxx/post1/ and this redirect to domain2.xxx/home/ (but i'm sure that post1 is still prensent in first url) is possible get content of post1 from the domain1.xxx?

<?php 

$url = 'domain1.xxx/post1/'; 
    $ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,$url); 
curl_setopt($ch, CURLOPT_HEADER,1); 
curl_setopt($ch, CURLOPT_NOBODY,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //important
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0);//important

$r = curl_exec($ch); 
curl_close($ch); 
echo $r;

?>`

But so return me :

"Moved Permanently

The document has moved here."

is a test is not hacking i have a authorization of owner of the site to test this. The site is done with wordpress.

Thnak you

1
Not possible according according to my knowledgeAnant Kumar Singh

1 Answers

0
votes

It's entirely unlikely for this to be possible given that it's usually the web server which serves the 301 information and redirects the page (eg a .htaccess file). This means the web server won't look for a web page to serve and thus won't serve up files or data.

In fact, it's likely that the original content doesn't even exist any more, if the owner has already deleted the content (or moved it to the new place).

(I use the word "likely" in this as it really depends on specific server configuration.)