Should I redirect the directory listing page of a parallel secondary directory to the primary directory?

Should I redirect the directory listing page of a parallel secondary directory to the primary directory? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Should I redirect the directory listing page of a parallel secondary directory to the primary directory? error on your web browser. Problem :


I have a website where I have a few sub-directories to list services. So it goes like this.



  • example.com/services/website-development.html

  • example.com/services/web-development/e-commerce.html

  • example.com/services/web-development/wordpress.html


I used web-development because I couldn't use a directory with the name website-development as example.com/services/website-development.html is a page.


Now the problem is that Google is has crawled the directory listing page at example.com/services/web-development. It is trying to index the page and I'm getting mobile usability errors in Search Console:



Text too small to read, Clickable elements too close together, Viewport not set



There is no index.html in that directory.


Is redirecting that URL to the website-development.html URL the best way to deal with the situation?


Solution :

If there is not site at example.com/services/web-development, you can use a redirect to push anything that accesses that URL to the correct place, maybe also use a sitemap.xml to define what Google indexes.


Using htaccess in your root level of your web server, how you redirect one page to another is:


RewriteRule ^url-string-to-redirect$ http://www.yourdomain.com/your-new-url-string [R=301,L]

Or


Redirect 301 /path/to-old-url    http://www.cyourdomain.com/path/to-new-url

To redirect the contents of a whole directory to another use the below:


RewriteRule ^subdirectory/(.*)$ /anotherdirectory/$1 [R=301,NC,L]

To redirect the contents of a whole directory to the webserving root:


RewriteRule ^subdirectory/(.*)$ /$1 [R=301,NC,L]

To redirect the contents of a subdirectory to another domain but in the same subdirectory


Redirect 301 /subdirectory http://www.anotherdomain.com/subdirectory

Make sure that the opening of the .htaccess file contains the 2 lines of code below which enables the Apache module to rewrite the URLS, then place your redirections below them


Options +FollowSymLinks
RewriteEngine On

We hope that this article has helped you resolve the seo, google-search-console, redirects error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=