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?


1 Answer 1


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]


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
  • Thanks @LinuxSurfaceNut, there is nothing at example.com/services/web-development. I'm just using it as a directory so that I could include more "web development" services inside. So example.com/services/web-development/wordpress.html
    – Nina
    Commented Sep 18, 2020 at 16:21
  • I think if I redirect example.com/services/web-development/ to another page, all pages in that directory will also be re-directed
    – Nina
    Commented Sep 18, 2020 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.