SlideShare a Scribd company logo
Learn how to use 
the .htaccess file 
A quick and handy tutorial
What is .htaccess ? 
The .htaccess file is a configuration file for 
web servers running the Apache Web 
server software 
December 2014 http://www.istogram.com 2
What is .htaccess ? 
Configuration is performed by .htaccess 
on a per-directory basis 
December 2014 http://www.istogram.com 3
What is .htaccess ? 
The dot before the filename means 
that the file is hidden (in Unix-like 
Operating Systems) 
December 2014 http://www.istogram.com 4
Use .htaccess for : 
● URL rewriting (pretty URLs, easy 
to remember URLs, SEF URLs) 
December 2014 http://www.istogram.com 5
Use .htaccess for : 
● URL redirects (site migrations, 
site upgrades, duplicate content) 
December 2014 http://www.istogram.com 6
Use .htaccess for : 
● Basic authentication 
December 2014 http://www.istogram.com 7
Use .htaccess for : 
● Security increase by blocking IP 
addresses 
December 2014 http://www.istogram.com 8
Use .htaccess for : 
● Enabling gzip compression to 
optimize performance 
December 2014 http://www.istogram.com 9
Use .htaccess for : 
● Creating custom error pages 
December 2014 http://www.istogram.com 10
Use .htaccess for : 
● Hiding directory listings 
December 2014 http://www.istogram.com 11
Use .htaccess for : 
● Enabling browser caching 
December 2014 http://www.istogram.com 12
How to make a .htaccess: 
● Use any text editor (such as 
NotePad, UltraEdit, TextEdit, Vim) 
December 2014 http://www.istogram.com 13
Examples : 
URL rewrite 
RewriteEngine on 
RewriteRule ^new_fancy.html$ old_ugly.html 
# This directive allows us to type 
# /new_fancy.html and get the file 
# /old_ugly.html 
December 2014 http://www.istogram.com 14
Examples : 
URL redirect 
REDIRECT DOMAIN.COM TO WWW.DOMAIN.COM 
RewriteEngine On 
RewriteBase / 
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC] 
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301] 
December 2014 http://www.istogram.com 15
Examples : 
URL redirect 
REDIRECT WWW.DOMAIN.COM TO DOMAIN.COM 
RewriteEngine On 
RewriteBase / 
RewriteCond %{HTTP_HOST} !^domain.com$ [NC] 
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301] 
December 2014 http://www.istogram.com 16
Examples : 
Simple URL redirect 
Redirect 301 ^old.html$ http://www.domain.com/new.html 
December 2014 http://www.istogram.com 17
Examples : 
Enable gzip compression 
<ifModule mod_gzip.c> 
mod_gzip_on Yes 
mod_gzip_dechunk Yes 
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ 
mod_gzip_item_include handler ^cgi-script$ 
mod_gzip_item_include mime ^text/.* 
mod_gzip_item_include mime ^application/x-javascript.* 
mod_gzip_item_exclude mime ^image/.* 
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* 
</ifModule> 
December 2014 http://www.istogram.com 18
Examples : 
Password protection 
AuthName "Member's Area Name" 
AuthUserFile /path/to/password/file/.htpasswd 
AuthType Basic 
require valid-user 
.htpasswd : 
username:encryptedpassword 
fred_smith:oCF9Pam/MXJg2 
Note that the password must be encrypted! 
December 2014 http://www.istogram.com 19
Examples : 
Custom error pages 
ErrorDocument 401 /err or_pages/401.html 
ErrorDocument 404 /error_pages/404.html 
ErrorDocument 500 /error_pages/500.html 
December 2014 http://www.istogram.com 20
Examples : 
Deny visitors by IP address 
order allow,deny 
deny from 255.0.0.0 
deny from 123.45.6. 
allow from all 
Users from the IP address '255.0.0.0' as well as from 
the IP range '123.45.6.1' to '123.45.6.255' will be blocked. 
December 2014 http://www.istogram.com 21
Examples : 
Disable directory listings 
IndexIgnore * 
To prevent listing multiple file types : 
IndexIgnore *.zip *.jpg *.gif 
December 2014 http://www.istogram.com 22
Examples : 
Leverage browser caching 
<IfModule mod_expires.c> 
ExpiresActive On 
ExpiresByType image/jpg "access 1 year" 
ExpiresByType image/jpeg "access 1 year" 
ExpiresByType image/gif "access 1 year" 
ExpiresByType image/png "access 1 year" 
ExpiresByType text/css "access 1 month" 
ExpiresByType text/html "access 1 month" 
ExpiresByType application/pdf "access 1 month" 
ExpiresByType text/x-javascript "access 1 month" 
ExpiresByType application/x-shockwave-flash "access 1 month" 
ExpiresByType image/x-icon "access 1 year" 
ExpiresDefault "access 1 month" 
</IfModule> 
December 2014 http://www.istogram.com 23
Summary : 
The .htaccess file can be a valuable tool for a 
variety of tasks. 
Learning how to use a .htaccess file is an 
essential skill for any webmaster. 
December 2014 http://www.istogram.com 24
Thank you! 
You may also visit our blog at : 
http://www.istogram.com/en/blog.html 
December 2014 http://www.istogram.com 25

More Related Content

What's hot

Александр Сергиенко, Senior Android Developer, DataArt
Александр Сергиенко, Senior Android Developer, DataArtАлександр Сергиенко, Senior Android Developer, DataArt
Александр Сергиенко, Senior Android Developer, DataArt
Alina Vilk
 
NYT Web Archive
NYT Web ArchiveNYT Web Archive
NYT Web Archive
Justin Heideman
 
Webinar: MongoDB Connector for Spark
Webinar: MongoDB Connector for SparkWebinar: MongoDB Connector for Spark
Webinar: MongoDB Connector for Spark
MongoDB
 
Introduction of own cloud
Introduction of own cloudIntroduction of own cloud
Introduction of own cloud
Zhichao Liang
 
MongoDB
MongoDBMongoDB
MongoDB
jsterce
 
Using WordPress as a Static Site Generator
Using WordPress as a Static Site GeneratorUsing WordPress as a Static Site Generator
Using WordPress as a Static Site Generator
Brecht Ryckaert
 
Htaccess - SEO-mæssigt
Htaccess - SEO-mæssigtHtaccess - SEO-mæssigt
Htaccess - SEO-mæssigt
AbMano - marketing & websupport
 
Basic about website george
Basic about website georgeBasic about website george
Basic about website george
Time Tutors
 
File uploads to s3
File uploads to s3File uploads to s3
File uploads to s3
varunlalan
 
Creative Web 01 - Introduction to the web & web development
Creative Web 01 - Introduction to the web & web developmentCreative Web 01 - Introduction to the web & web development
Creative Web 01 - Introduction to the web & web development
Lukas Oppermann
 

What's hot (10)

Александр Сергиенко, Senior Android Developer, DataArt
Александр Сергиенко, Senior Android Developer, DataArtАлександр Сергиенко, Senior Android Developer, DataArt
Александр Сергиенко, Senior Android Developer, DataArt
 
NYT Web Archive
NYT Web ArchiveNYT Web Archive
NYT Web Archive
 
Webinar: MongoDB Connector for Spark
Webinar: MongoDB Connector for SparkWebinar: MongoDB Connector for Spark
Webinar: MongoDB Connector for Spark
 
Introduction of own cloud
Introduction of own cloudIntroduction of own cloud
Introduction of own cloud
 
MongoDB
MongoDBMongoDB
MongoDB
 
Using WordPress as a Static Site Generator
Using WordPress as a Static Site GeneratorUsing WordPress as a Static Site Generator
Using WordPress as a Static Site Generator
 
Htaccess - SEO-mæssigt
Htaccess - SEO-mæssigtHtaccess - SEO-mæssigt
Htaccess - SEO-mæssigt
 
Basic about website george
Basic about website georgeBasic about website george
Basic about website george
 
File uploads to s3
File uploads to s3File uploads to s3
File uploads to s3
 
Creative Web 01 - Introduction to the web & web development
Creative Web 01 - Introduction to the web & web developmentCreative Web 01 - Introduction to the web & web development
Creative Web 01 - Introduction to the web & web development
 

Viewers also liked

Task11
Task11Task11
Introduction to "robots.txt
Introduction to "robots.txtIntroduction to "robots.txt
Introduction to "robots.txt
Ishan Mishra
 
PSY1011 rocking referencing
PSY1011 rocking referencingPSY1011 rocking referencing
PSY1011 rocking referencing
John Iona
 
Empowering Manhattan’s Communities
Empowering Manhattan’s CommunitiesEmpowering Manhattan’s Communities
Empowering Manhattan’s Communities
Michelle Feldman
 
Formal proposal
Formal proposalFormal proposal
Formal proposal
AS Media Column C
 
How to create favicon
How to create faviconHow to create favicon
How to create favicon
Tanuja Talekar
 
Steps for adding sitemap to webmaster tool
Steps for adding  sitemap to    webmaster  toolSteps for adding  sitemap to    webmaster  tool
Steps for adding sitemap to webmaster tool
OM Maurya
 
R&amp;b history
R&amp;b historyR&amp;b history
R&amp;b history
AS Media Column C
 
How to create favicon
How to   create    faviconHow to   create    favicon
How to create favicon
OM Maurya
 
how to create a blog on wordpress
how to create  a blog  on  wordpress how to create  a blog  on  wordpress
how to create a blog on wordpress
OM Maurya
 
How to create rss feed for your website
How to create  rss feed  for  your  websiteHow to create  rss feed  for  your  website
How to create rss feed for your website
OM Maurya
 
Chapple, R. M. 2014 A Game of Murals. Westeros & Changing Times in East Belfa...
Chapple, R. M. 2014 A Game of Murals. Westeros & Changing Times in East Belfa...Chapple, R. M. 2014 A Game of Murals. Westeros & Changing Times in East Belfa...
Chapple, R. M. 2014 A Game of Murals. Westeros & Changing Times in East Belfa...
Robert M Chapple
 
How to create rss feed
How to create rss feedHow to create rss feed
How to create rss feed
Tanuja Talekar
 
How to track website visitors using Google analytics
How to track website visitors using Google analyticsHow to track website visitors using Google analytics
How to track website visitors using Google analytics
Tanuja Talekar
 
how to setup Google analytics tracking code for website
how to setup  Google analytics tracking code for websitehow to setup  Google analytics tracking code for website
how to setup Google analytics tracking code for website
OM Maurya
 
How to create sitemap for website
How to create sitemap for websiteHow to create sitemap for website
How to create sitemap for website
OM Maurya
 
Evareporte
EvareporteEvareporte
Evareporte
edith maigua
 

Viewers also liked (17)

Task11
Task11Task11
Task11
 
Introduction to "robots.txt
Introduction to "robots.txtIntroduction to "robots.txt
Introduction to "robots.txt
 
PSY1011 rocking referencing
PSY1011 rocking referencingPSY1011 rocking referencing
PSY1011 rocking referencing
 
Empowering Manhattan’s Communities
Empowering Manhattan’s CommunitiesEmpowering Manhattan’s Communities
Empowering Manhattan’s Communities
 
Formal proposal
Formal proposalFormal proposal
Formal proposal
 
How to create favicon
How to create faviconHow to create favicon
How to create favicon
 
Steps for adding sitemap to webmaster tool
Steps for adding  sitemap to    webmaster  toolSteps for adding  sitemap to    webmaster  tool
Steps for adding sitemap to webmaster tool
 
R&amp;b history
R&amp;b historyR&amp;b history
R&amp;b history
 
How to create favicon
How to   create    faviconHow to   create    favicon
How to create favicon
 
how to create a blog on wordpress
how to create  a blog  on  wordpress how to create  a blog  on  wordpress
how to create a blog on wordpress
 
How to create rss feed for your website
How to create  rss feed  for  your  websiteHow to create  rss feed  for  your  website
How to create rss feed for your website
 
Chapple, R. M. 2014 A Game of Murals. Westeros & Changing Times in East Belfa...
Chapple, R. M. 2014 A Game of Murals. Westeros & Changing Times in East Belfa...Chapple, R. M. 2014 A Game of Murals. Westeros & Changing Times in East Belfa...
Chapple, R. M. 2014 A Game of Murals. Westeros & Changing Times in East Belfa...
 
How to create rss feed
How to create rss feedHow to create rss feed
How to create rss feed
 
How to track website visitors using Google analytics
How to track website visitors using Google analyticsHow to track website visitors using Google analytics
How to track website visitors using Google analytics
 
how to setup Google analytics tracking code for website
how to setup  Google analytics tracking code for websitehow to setup  Google analytics tracking code for website
how to setup Google analytics tracking code for website
 
How to create sitemap for website
How to create sitemap for websiteHow to create sitemap for website
How to create sitemap for website
 
Evareporte
EvareporteEvareporte
Evareporte
 

Similar to Learn how to use the .htaccess file

WordPress Hosting Best Practices - Do's and Don't s | WordPress Trivandrum
WordPress Hosting Best Practices - Do's and Don't s  | WordPress TrivandrumWordPress Hosting Best Practices - Do's and Don't s  | WordPress Trivandrum
WordPress Hosting Best Practices - Do's and Don't s | WordPress Trivandrum
WordPress Trivandrum
 
Htaccess file tutorial and tips
Htaccess file tutorial and tipsHtaccess file tutorial and tips
Htaccess file tutorial and tips
Imam Rosidi
 
Apache Web Server Setup 3
Apache Web Server Setup 3Apache Web Server Setup 3
Apache Web Server Setup 3
Information Technology
 
AEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser CachingAEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser Caching
Andrew Khoury
 
High-Speed HTML5
High-Speed HTML5High-Speed HTML5
High-Speed HTML5
Peter Lubbers
 
21 05-2018
21 05-201821 05-2018
21 05-2018
Praaveen Vr
 
are available here
are available hereare available here
are available here
webhostingguy
 
Optimising Web Application Frontend
Optimising Web Application FrontendOptimising Web Application Frontend
Optimising Web Application Frontend
tkramar
 
Securing Apache Web Servers
Securing Apache Web ServersSecuring Apache Web Servers
Securing Apache Web Servers
webhostingguy
 
Securing Apache Web Servers
Securing Apache Web ServersSecuring Apache Web Servers
Securing Apache Web Servers
Information Technology
 
5-WebServers.ppt
5-WebServers.ppt5-WebServers.ppt
5-WebServers.ppt
webhostingguy
 
Complete Wordpress Security By CHETAN SONI - Cyber Security Expert
Complete Wordpress Security By CHETAN SONI - Cyber Security ExpertComplete Wordpress Security By CHETAN SONI - Cyber Security Expert
Complete Wordpress Security By CHETAN SONI - Cyber Security Expert
Chetan Soni
 
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
cgmonroe
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
Anam Ahmed
 
Backing up your WordPress website – it’s not optional
Backing up your WordPress website – it’s not optionalBacking up your WordPress website – it’s not optional
Backing up your WordPress website – it’s not optional
R-Cubed Design Forge
 
Use Xdebug to profile PHP
Use Xdebug to profile PHPUse Xdebug to profile PHP
Use Xdebug to profile PHP
Seravo
 
Web Front End Performance
Web Front End PerformanceWeb Front End Performance
Web Front End Performance
Chris Love
 
Word press bg 16x9 draft 16
Word press bg 16x9 draft 16Word press bg 16x9 draft 16
Word press bg 16x9 draft 16
msz
 
Backups, Backups, Backups
Backups, Backups, BackupsBackups, Backups, Backups
Backups, Backups, Backups
R-Cubed Design Forge
 
WordPress MU 101
WordPress MU 101WordPress MU 101
WordPress MU 101
Pete Mall
 

Similar to Learn how to use the .htaccess file (20)

WordPress Hosting Best Practices - Do's and Don't s | WordPress Trivandrum
WordPress Hosting Best Practices - Do's and Don't s  | WordPress TrivandrumWordPress Hosting Best Practices - Do's and Don't s  | WordPress Trivandrum
WordPress Hosting Best Practices - Do's and Don't s | WordPress Trivandrum
 
Htaccess file tutorial and tips
Htaccess file tutorial and tipsHtaccess file tutorial and tips
Htaccess file tutorial and tips
 
Apache Web Server Setup 3
Apache Web Server Setup 3Apache Web Server Setup 3
Apache Web Server Setup 3
 
AEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser CachingAEM (CQ) Dispatcher Security and CDN+Browser Caching
AEM (CQ) Dispatcher Security and CDN+Browser Caching
 
High-Speed HTML5
High-Speed HTML5High-Speed HTML5
High-Speed HTML5
 
21 05-2018
21 05-201821 05-2018
21 05-2018
 
are available here
are available hereare available here
are available here
 
Optimising Web Application Frontend
Optimising Web Application FrontendOptimising Web Application Frontend
Optimising Web Application Frontend
 
Securing Apache Web Servers
Securing Apache Web ServersSecuring Apache Web Servers
Securing Apache Web Servers
 
Securing Apache Web Servers
Securing Apache Web ServersSecuring Apache Web Servers
Securing Apache Web Servers
 
5-WebServers.ppt
5-WebServers.ppt5-WebServers.ppt
5-WebServers.ppt
 
Complete Wordpress Security By CHETAN SONI - Cyber Security Expert
Complete Wordpress Security By CHETAN SONI - Cyber Security ExpertComplete Wordpress Security By CHETAN SONI - Cyber Security Expert
Complete Wordpress Security By CHETAN SONI - Cyber Security Expert
 
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
 
Backing up your WordPress website – it’s not optional
Backing up your WordPress website – it’s not optionalBacking up your WordPress website – it’s not optional
Backing up your WordPress website – it’s not optional
 
Use Xdebug to profile PHP
Use Xdebug to profile PHPUse Xdebug to profile PHP
Use Xdebug to profile PHP
 
Web Front End Performance
Web Front End PerformanceWeb Front End Performance
Web Front End Performance
 
Word press bg 16x9 draft 16
Word press bg 16x9 draft 16Word press bg 16x9 draft 16
Word press bg 16x9 draft 16
 
Backups, Backups, Backups
Backups, Backups, BackupsBackups, Backups, Backups
Backups, Backups, Backups
 
WordPress MU 101
WordPress MU 101WordPress MU 101
WordPress MU 101
 

Recently uploaded

Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
Toptal Tech
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
wolfsoftcompanyco
 
Azure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdfAzure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdf
AanSulistiyo
 
[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
hackersuli
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
xjq03c34
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
k4ncd0z
 
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
uehowe
 
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
zoowe
 
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
bseovas
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
zyfovom
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
uehowe
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
Danica Gill
 
Design Thinking NETFLIX using all techniques.pptx
Design Thinking NETFLIX using all techniques.pptxDesign Thinking NETFLIX using all techniques.pptx
Design Thinking NETFLIX using all techniques.pptx
saathvikreddy2003
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
Trish Parr
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
ukwwuq
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
3a0sd7z3
 
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
uehowe
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
cuobya
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
Paul Walk
 

Recently uploaded (20)

Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
 
Azure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdfAzure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdf
 
[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
 
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
 
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
 
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
 
Design Thinking NETFLIX using all techniques.pptx
Design Thinking NETFLIX using all techniques.pptxDesign Thinking NETFLIX using all techniques.pptx
Design Thinking NETFLIX using all techniques.pptx
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
 
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
 

Learn how to use the .htaccess file

  • 1. Learn how to use the .htaccess file A quick and handy tutorial
  • 2. What is .htaccess ? The .htaccess file is a configuration file for web servers running the Apache Web server software December 2014 http://www.istogram.com 2
  • 3. What is .htaccess ? Configuration is performed by .htaccess on a per-directory basis December 2014 http://www.istogram.com 3
  • 4. What is .htaccess ? The dot before the filename means that the file is hidden (in Unix-like Operating Systems) December 2014 http://www.istogram.com 4
  • 5. Use .htaccess for : ● URL rewriting (pretty URLs, easy to remember URLs, SEF URLs) December 2014 http://www.istogram.com 5
  • 6. Use .htaccess for : ● URL redirects (site migrations, site upgrades, duplicate content) December 2014 http://www.istogram.com 6
  • 7. Use .htaccess for : ● Basic authentication December 2014 http://www.istogram.com 7
  • 8. Use .htaccess for : ● Security increase by blocking IP addresses December 2014 http://www.istogram.com 8
  • 9. Use .htaccess for : ● Enabling gzip compression to optimize performance December 2014 http://www.istogram.com 9
  • 10. Use .htaccess for : ● Creating custom error pages December 2014 http://www.istogram.com 10
  • 11. Use .htaccess for : ● Hiding directory listings December 2014 http://www.istogram.com 11
  • 12. Use .htaccess for : ● Enabling browser caching December 2014 http://www.istogram.com 12
  • 13. How to make a .htaccess: ● Use any text editor (such as NotePad, UltraEdit, TextEdit, Vim) December 2014 http://www.istogram.com 13
  • 14. Examples : URL rewrite RewriteEngine on RewriteRule ^new_fancy.html$ old_ugly.html # This directive allows us to type # /new_fancy.html and get the file # /old_ugly.html December 2014 http://www.istogram.com 14
  • 15. Examples : URL redirect REDIRECT DOMAIN.COM TO WWW.DOMAIN.COM RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301] December 2014 http://www.istogram.com 15
  • 16. Examples : URL redirect REDIRECT WWW.DOMAIN.COM TO DOMAIN.COM RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^domain.com$ [NC] RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301] December 2014 http://www.istogram.com 16
  • 17. Examples : Simple URL redirect Redirect 301 ^old.html$ http://www.domain.com/new.html December 2014 http://www.istogram.com 17
  • 18. Examples : Enable gzip compression <ifModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* </ifModule> December 2014 http://www.istogram.com 18
  • 19. Examples : Password protection AuthName "Member's Area Name" AuthUserFile /path/to/password/file/.htpasswd AuthType Basic require valid-user .htpasswd : username:encryptedpassword fred_smith:oCF9Pam/MXJg2 Note that the password must be encrypted! December 2014 http://www.istogram.com 19
  • 20. Examples : Custom error pages ErrorDocument 401 /err or_pages/401.html ErrorDocument 404 /error_pages/404.html ErrorDocument 500 /error_pages/500.html December 2014 http://www.istogram.com 20
  • 21. Examples : Deny visitors by IP address order allow,deny deny from 255.0.0.0 deny from 123.45.6. allow from all Users from the IP address '255.0.0.0' as well as from the IP range '123.45.6.1' to '123.45.6.255' will be blocked. December 2014 http://www.istogram.com 21
  • 22. Examples : Disable directory listings IndexIgnore * To prevent listing multiple file types : IndexIgnore *.zip *.jpg *.gif December 2014 http://www.istogram.com 22
  • 23. Examples : Leverage browser caching <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType text/html "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType text/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access 1 month" </IfModule> December 2014 http://www.istogram.com 23
  • 24. Summary : The .htaccess file can be a valuable tool for a variety of tasks. Learning how to use a .htaccess file is an essential skill for any webmaster. December 2014 http://www.istogram.com 24
  • 25. Thank you! You may also visit our blog at : http://www.istogram.com/en/blog.html December 2014 http://www.istogram.com 25