Home htaccess: Rewrite to root index from subfolder
Reply: 0

htaccess: Rewrite to root index from subfolder

bqem
1#
bqem Published in 2018-02-12 10:52:55Z

I want to rewrite from all subfolders to the root folder with the following .htaccess in root:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule   . index.html [L]

I have the following structure

index.html
existing-subfolder/
index.js
request.js
.htaccess

When I load:

www.domain.de/existing-subfolder

it rewrites to www.domain.de/index.html but i get errors from AJAX loading scripts, because the request url (i.e. "request.js") is now www.domain.de/existing-subfolder/request.js

When the subfolder is not existing (www.domain.de/not-existing-subfolder), everything works. The request url is now www.domain.de/request.js

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.487056 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO