I need to create a 410 "gone"' for Wordpress Blog and modify htaccess file with the proper code on Cpanel

974 Views Asked by At

I created a WordPress page a while back and I entered the slug incorrectly so I modified it recently.

There was just an extra number at the end of the URL that shouldn’t have been there and I just wanted it gone so I erased it.

The original URL looked something like this:

https://myexample.ca/how-to-create-an-example-3/

I edited it and removed the 3 at the end so it would look like the following:

http://myexample.ca/how-to-create-an-example/

I was told by my SEO manager that I need to modify the htaccess file from within the server to tell Google not to crawl it anymore and deindex it by using a 410 command line or code and inserting it into the htaccess file. I know this can be done easily with a plugin, however, I am trying to limit my usage of plugins in general.

I’ve seen examples - some more complex than others - but here’s one that I thought might work:

Redirect gone /path/path/folder/
ErrorDocument 410 default 

The only problem is I can’t seem to figure out how to find the path since I’m not supposed to use the URL but just a path on the server.

I’ve looked within the cPanel and can’t find where my specific page is. I understand that WordPress is created dynamically using PHP so finding a single HTML file with all my content won’t be available without viewing it through PHP my admin if this is right?

I've looked in

/public_html/wp-content/themes/oceanwp

My questions are:

  1. Do I add a path and how do I find this path?

  2. What code should I specifically use because I don’t wanna mess up the htaccess file and disable or break my site?

  3. Do I need to create a 410 landing page? (My site is fairly new and nobody visits the old page anyway. I'm doing this more for google so it doesn't affect my ratings)

Also, I'm aware that eventually google will deindex it after several 404's and crawls. I'm just trying to speed up that process.

Apologies for the novel

Update on July 29, 2020

Here's the code I ended up using

RewriteEngine On
RewriteBase /
Redirect gone /how-to-create-an-example-3/
Redirect gone /how-to-create-another-example-3/
Redirect gone /how-to-create-yet-another-example-3/
ErrorDocument 410 default
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>.  

As you can see I added 3 separate pages to respond with 410 pages.

I couldn't figure out how to list them consecutively like in a span and tried multiple ways using () or | to separate and it wouldn't take; meaning no pages returned 410.

However, when I listed them each on their own separate lines, then all of the page requests returned a 410 response as desired.

Is there any disadvantage to writing the code this way?

The path/path/folder that I found on another forum (the original example above) was a poor example of what I needed since it ended up being a forward slash/then the slug exactly as written without the domain.

ie. https://myexample.ca/how-to-create-an-example-3/

stripped to

/how-to-create-an-example-3/

0

There are 0 best solutions below