Search code examples
apache.htaccessmod-rewriteskipapple-app-site-association

.htaccess skip apple-app-site-association but filter other


I have a rule for changing the extension

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^item/(.*)/?$ item.php/$1 [NC,L]
RewriteRule ^([^.]+)$ $1.php [NC,L]

All fine But this rule also filter apple-app-site-association

Need skip apple-app-site-association but filter other

I tried add code below but to no avail

RewriteRule ^apple([a-z]+)$ $1 [NC,L]
RewriteRule apple-app-site-association$ $1 [NC,L]
RewriteRule ^apple([a-z]+)$ $1 [NC,L,S=2]

Solution

  • You can use the following:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^item/(.*)/?$ item.php/$1 [NC,L]
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule ^([^.]+)/?$ $1.php [NC,L]
    

    The condition above makes sure you don't rewrite your existing files and folders.