• Resolved Taswir

    (@taswir)


    Hi I spent many hours solving this but not much luck!

    I am getting increasing number of 404 errors for pages (they are html pages from previous site owner which no longer exist, I am running my new site on it). There are couple of hundreds non-exist html pages like these. And as these pages have some quality backlinks, I want to redirect them to my homepage and other important pages. But the pages ending with .html, .pdf, .asp etc do not redirect to my pages.

    My permalink structure is like – https://www.example.com/sample-post/

    Any advise please? Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author John Godley

    (@johnny5)

    Thread Starter Taswir

    (@taswir)

    Hi John,

    Thank you very much for your reply.

    I checked with my hosting provider and they confirmed that everything is fine from their server end. They asked me about the .htaccess redirection rule, so can we use the following one to force trailing slash to get rid of this issue:

    # Force trailing slash
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_METHOD} GET
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301]

    Thank you very much.

    Plugin Author John Godley

    (@johnny5)

    I’m a bit confused – is this a solution or a question? You didn’t mention having a problem with trailing slashes originally.

    The page I linked to is about the server directly serving static files before Redirection has chance to run, and so you need to save the redirects to your .htaccess file. You can also modify your server to check that static files exist before it tries to serve them.

    Thread Starter Taswir

    (@taswir)

    Hi John,

    Actually what I found that those non-exist html pages do not redirect to my current live pages.

    So basically what I am trying to do is –

    source page – https://www.example.com/page.html/
    target page – https://www.example.com/

    non-exist page – https://www.example.com/page.html (when i force it with trailing slash, it redirects to the source page and then target page)

    I am wondering whether adding trailing slash is the acceptable solution for this.

    Thank you very much.

    • This reply was modified 7 years, 1 month ago by Taswir.
    Plugin Author John Godley

    (@johnny5)

    > I am wondering whether adding trailing slash is the acceptable solution for this.

    I still don’t really understand what the problem is. If it helps your situation then by all means do it. With regards to Redirection, if you have issues redirecting URLs that end in .html then you can use the link I added above.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Static Page Redirection Help’ is closed to new replies.