Last active
July 1, 2019 02:18
-
-
Save FerraBraiZ/b3bcaa728b8ae63be5ed3358a8fc441b to your computer and use it in GitHub Desktop.
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
# Allow with + or - listing folder's content | |
Options +Indexes | |
##enable CORS and credentials | |
<IfModule mod_headers.c> | |
Header set Access-Control-Allow-Origin "*" | |
Header set Access-Control-Allow-Origin http://www.vknyvz.com | |
Header set Access-Control-Allow-Credentials true | |
</IfModule> | |
#Allow detailed listing of the folder's content | |
IndexOptions FancyIndexing | |
#change main file type | |
DirectoryIndex main.php | |
#disable listing files by extension | |
IndexIgnore *.txt *.ico *.ini *.css * | |
#add your own file extension to be parsed as php | |
AddType application/x-httpd-php .agw | |
#disable access to some file | |
<files file.txt> | |
order allow,deny | |
deny from all | |
</files> | |
#disable access to files via regular expression | |
<FilesMatch "\.(txt|ico)$" > | |
order allow,deny | |
deny from all | |
</FilesMatch> | |
#AddDefaultCharset | |
AddDefaultCharset utf-8 | |
#set 404 error document | |
ErrorDocument 404 /fileNotFount.php | |
# Turn Rewrite Engine On | |
RewriteEngine on | |
# Rewrite for projects.php | |
RewriteRule ^custom$ projects.php [NC,L] | |
# NC makes the rule non case sensitive | |
# L makes this the last rule that this specific condition will match | |
# $ in the regular expression makes the matching stop so that "customblah" will not work | |
# Rewrite for user.php?u=xxxxx | |
RewriteRule ^user/([0-9a-zA-Z]+)$ user.php?u=$1 [NC,L] | |
# Rewrite for article.php?id=1&title=Title-Goes-Here | |
RewriteRule ^article/([0-9]+)/([0-9a-zA-Z_-]+)$ article.php?id=$1&title=$2 [NC,L] | |
# ---- Make pages render without their extension in the url | |
Options +MultiViews |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment