Should I redirect the directory listing page of a parallel secondary directory to the primary directory?
I have a website where I have a few sub-directories to list services. So it goes like this.
example.com/services/website-development.htmlexample.com/services/web-development/e-commerce.htmlexample.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?
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
Comments
Post a Comment