Mobile app version of vmapp.org
Login or Join
Gonzalez347

: Implementing 301 redirects won't work without an existing file. Will that matter to Google or is there a better way to implement redirects? I just published a completely revised version of a

@Gonzalez347

Posted in: #301Redirect #GoogleSearch #Indexing #Seo #Url

I just published a completely revised version of a website (static site to a Wordpress powered one) without changing the domain or the web server. In the old site the URL structure was


example.com/product_category1.php
example.com/product1.php


and in the current one it is:


example.com/product_category1/
example.com/product_category1/product1/


so now it's more logical and without .php extensions.

Now, if I do a Google search e.g. for "product category 1", example.com/product_category1.php ranks higher than example.com/product_category1. I solved this by applying a 301 redirect from the GUI offered by my web hosting company, so now example.com/product_category1.php redirects to example.com/product_category1/. I noticed that I have to keep product_category1.php file in the public_html folder in order for the redirection to happen, otherwise the only redirection that happens is to the 404 page.

I'd like the example.com/product_category1.php and other .php extended URLs to vanish from the search results. Will they do so if they always get redirected, even though they still exist in the public_html folder? Is there a way to do the redirection without keeping the files? Or should this be dealt in a completely different manner in order to have maximum SEO and visibility for correct URLs in the new website?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Gonzalez347

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ann8826881

...a 301 redirect from the GUI offered by my web hosting company ... I have to keep product_category1.php file in the public_html folder in order for the redirection to happen, otherwise the only redirection that happens is to the 404 page.


It sounds like the redirect has been implemented incorrectly (or rather, in the wrong place in your .htaccess file) by the hosting GUI. You should not need to keep the old .php files from which you are redirecting (although this makes no difference from an SEO point of view - it's being redirected).

It is a common problem with using a 3rd party tool (hosting GUI / cPanel for example) to implement redirects when you have an existing system in place. WordPress itself places directives in your .htaccess file (Apache per-directory config file) and the "hosting GUI" is probably doing the same when it implements the redirect. Without knowing exactly what your current directives are doing (which your "hosting GUI" probably does not) it is difficult to reliably make any "automatic" changes.

My guess is that the redirect directives have been placed after the existing WordPress directives by the "hosting GUI". Whereas they would need to be placed before the existing WP directives.

If the redirect directives are placed after the WP directives then they will only be processed if the file actually exists, because WP routes all non-existent files and processing stops there. But if the file doesn't exist then WP routes the URL and you get the 404, because the old URL is not a valid WP URL. This seems to be what is happening here.

If you add the contents of your /.htaccess file to your question then we can verify this.


Will they [vanish] if they always get redirected, even though they still exist in the public_html folder?


Yes. Eventually the old URLs will disappear from the SERPs if they are 301 redirected. From a search engine / end user point of view, it makes no difference whether the original file still exists or not. It is redirected, so they have no way of knowing.


Is there a way to do the redirection without keeping the files?


Yes, as mentioned above. It would only seem to be because of a conflict with existing directives that you are getting this seemingly bizarre behaviour. Taken out of context, you would get a puzzled look if you said to someone that the file needed to exist before you could redirect it!


Or should this be dealt in a completely different manner in order to have maximum SEO and visibility for correct URLs in the new website?


A 301 redirect is all that's required. However, it should have been implemented in the very beginning, as soon as the URLs changed, in order to have had "maximum SEO".

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme