VARIS VONGUEA-AREE

🔥🇹🇭 Bangkok Thailand

High level experience in web design and development knowledge, producing quality work.

การตั้งค่า htaccess Apache Web Server🔗

hypertext access เป็นตัวแรกที่จัดการ route ในแต่ละ Directory สามารถมีไฟล์ .htacess ได้ไฟล์เดียว

HTTP Return status ทั้งหมด https://httpstatuses.com/

Combine mergin 2 line https://www.gillmeister-software.com/online-tools/text/merge-lists-line-by-line.aspx

SSL HTTPS🔗

ewriteEngine onRewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]

orRewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.test\.com$ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.test\.com$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]</IfModule>

Remove Index?🔗

RewriteCond %{THE_REQUEST} /index\.php/(.+)\sHTTP [NC]
RewriteRule ^ /%1 [NE,L,R=301]RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /index.php/$1 [L]//Allow Folder File not have index.php
RewriteCond $1 !^(index\.php|assets|images|robots\.txt|sitemap\.xml)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteRule ^content/([^/]*)/([^/]*).html /page.php?content=content&id=$1&name=$2 [L]
RewriteRule ^pages/([^/]*)/([^/]*).html /page.php?content=pages&id=$1&name=$2 [L]
RewriteRule ^news-event/([^/]*)/([^/]*).html /page.php?content=news&id=$1&name=$2 [L]
RewriteRule ^category.html /category.php [L]
RewriteRule ^category/main/([^/]*)/([^/]*).html /category.php?maincate=$1&name=$2 [L]
RewriteRule ^category/sub/([^/]*)/([^/]*).html /category.php?subcate=$1&name=$2 [L]

Redirect🔗

Redirect 301 /tstt /RHINOPLASTY.html
RedirectMatch ^/oldfolder/(.*) http://example.site/newfolder/$1

RewriteRule ^.*[-](\d+)/$ postnewl/index\.php?id=$1&%{QUERY_STRING} [L]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.shtml$ $1.html [L,NC,R=301]

RewriteRule ^news\/categoryfront\.php\/id\/13\/News\.html$ news/categoryfront-php/id/13/News.html [L,R=301]

RewriteCond %{QUERY_STRING} ^cid=14&lid=1043$
RewriteRule ^[/]? test/archive.html/14/1043? [L,R=301]

RewriteCond %{QUERY_STRING} ^cid=([0-9]+)&lid=([0-9]+)$
RewriteRule ^[/]? test/archive.html/%1/%2? [L,R=301]

//http://gas.th/1295dd-2/ to https://test\.com/new
RewriteRule ^1295-2/  https://test\.com/new/ [R=301,L]


GZIP🔗

<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>

Header Security🔗

<FilesMatch "\.(html|php)$">
Header set Content-Security-Policy "policy-definition
</FilesMatch>

<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=16070400"
Header set X-Content-Type-Options "nosniff"
Header set Referrer-Policy: unsafe-url
Header set X-Frame-Options DENY
Header always set X-Xss-Protection "1; mode=block"
Header always set Feature-Policy "same-origin"
Header set Expect-CT "max-age=7776000, enforce"
Header unset X-Powered-By
Header set Connection keep-alive
</IfModule>


https://github.com/phanan/htaccess```