I need to redirect a direct access folder to homepage


Recommended Posts

Hi, I need to redirect direct folder access to my homepage using .htaccess I tried following but its' not working

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

Currectly I add a blank index.html to each folder, but this is not a good solution. I want everytime someone tried to directly access an existing folder on my website it will redirected to homepage automatically via .htaccess

Please help




Link to comment
Share on other sites

Hello! .htaccess rules like this can be tricky as software you're using may automatically create rewrites and rules that contradict what you're trying to setup. For assistance with figuring that out (assuming you haven't already) please open a ticket at https://my.hawkhost.com/submitticket.php with our helpdesk team and provide them details of this issue. We'll be able to look into this specifically for your setup and try to get a rewrite working for you. Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.