Reputation: 53
My website : theexample.com I modified my .htaccess so that if visitors visits an unkown url it redirects directly to index.php with :
FallbackResource index.php
The problem is that it works only if there is one element after "theexample.com".
for example :
"theexample.com/shudhusdfuisdfhisdfh": works and redirects to
"theexample.com/sh/fuisd/fhisdfh": doesn't work and doesn't redirect to index.php.
Upvotes: 1
Views: 145
Reputation: 360
This is rewrite. Redirect only non-files links =)
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ index.php
Example: url http://example.com/asdjivuhr/34tv3t will redirext to index.php BUT if you have files(css,js) http://example.com/script.js will stay untooched if file exists!
Upvotes: 0
Reputation: 785126
You must use absolute path of fallback resource not a relative one:
FallbackResource /index.php
Otherwise FallbackResource index.php
will try to load index.php
in the provided sub-path e.g. theexample.com/sh/fuisd/fhisdfh
will try to load theexample.com/sh/fuisd/index.php
which will cause failure as that path doesn't exist resulting in Internal Server Error.
Upvotes: 1