Jump to content

Forward all subfolders/files to the root


tuckker

Recommended Posts

How do I redirect all subfolders/files to the root of the link domain.com?

 

Eg:

 

When user opens www.domain.com/abc, i want Apache (Tomcat to be exact) to redirectthe user to www.domain.com. This goes the same for www.domain.com/abc/abc or www.domain.com/abc/abc.html etc...

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/135274-forward-all-subfoldersfiles-to-the-root/
Share on other sites

I used the code you suggested, and the outcome was:

 

accessing domain.com will redirect perfectly fine.

 

But accessing domain.com/abc will gives me 404 error...

 

If I change it to:

 

redirectMatch permanent ^(/.+)?/?$ http://domain.com/index.htm

 

Then it will keep entering a loop... any idea?

 

Also, how do I add an exclusion to a folder?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.