Last active
June 4, 2024 02:03
-
-
Save tarikmanoar/2bcef1f57a9d6d705422d9595568bd61 to your computer and use it in GitHub Desktop.
Helpful .htaccess
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .htaccess for park main domain to a dir | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ | |
RewriteCond %{REQUEST_URI} !^/dir/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ /dir/$1 | |
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ | |
RewriteRule ^(/)?$ dir/ [L] | |
RewriteCond %{THE_REQUEST} /index\.php [NC] | |
RewriteCond %{REQUEST_URI} ^(.*/)index\.php$ [NC] | |
RewriteRule ^ %1 [L,R=301,NE] | |
//VUE Engine | |
// .htaccess | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.html$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.html [L] | |
</IfModule> | |
// Or | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . index.html [L] | |
// For Nginx server | |
location / { | |
try_files $uri $uri/ /index.html; | |
} | |
or | |
location / { | |
try_files $uri $uri/ =404; " with " try_files $uri $uri/ /index.html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment