{"id":357,"date":"2016-12-10T11:17:19","date_gmt":"2016-12-10T11:17:19","guid":{"rendered":"https:\/\/www.xsofthost.com\/help\/?p=357"},"modified":"2017-02-10T17:40:55","modified_gmt":"2017-02-10T17:40:55","slug":"htaccess-tutorial","status":"publish","type":"post","link":"https:\/\/www.xsofthost.com\/help\/htaccess-tutorial\/","title":{"rendered":"htaccess tutorial"},"content":{"rendered":"<h2>What .htaccess For<\/h2>\n<p><strong>.htaccess<\/strong> files (or &#8220;distributed configuration files&#8221;) provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all sub directories<\/p>\n<p> some configurations may you add to the file:<\/p>\n<p> <strong>REMOVE PHP HTML Extensions From THE URL :<\/strong><\/p>\n<p> For PHP<br \/>\n <code><br \/>\n RewriteCond %{REQUEST_FILENAME} !-f<br \/>\n RewriteRule ^([^\\.]+)$ $1.php [NC,L]<\/p>\n<p> <\/code> <br \/>\n For HTML<br \/>\n <code><br \/>\n RewriteCond %{REQUEST_FILENAME} !-f<br \/>\n RewriteRule ^([^\\.]+)$ $1.html [NC,L]<br \/>\n <\/code> <\/p>\n<p> <strong>REMOVE Libwww-perl Access Test<\/strong><br \/>\n <code><br \/>\n RewriteCond %{HTTP_USER_AGENT} libwww-perl.* <br \/>\n RewriteRule .* ? [F,L]<\/code> <\/p>\n<p> In order to improve the security of your site against some types of XSS (cross-site scripting) attacks, it is recommended that you add the following header to your site:<br \/>\n <code>&lt;IfModule mod_headers.c&gt;<br \/>\n Header set X-XSS-Protection \"1; mode=block\"<br \/>\n &lt;\/IfModule&gt;<\/code> <\/p>\n<p> In order to add browser caching to your website, you will need to set the date for when the cache expires:<\/p>\n<p>\n <code>&lt;IfModule mod_expires.c&gt;<br \/>\n ExpiresActive On<br \/>\n ExpiresByType image\/jpg \"access plus 1 year\"<br \/>\n ExpiresByType image\/jpeg \"access plus 1 year\"<br \/>\n ExpiresByType image\/gif \"access plus 1 year\"<br \/>\n ExpiresByType image\/png \"access plus 1 year\"<br \/>\n ExpiresByType text\/css \"access plus 1 month\"<br \/>\n ExpiresByType application\/pdf \"access plus 1 month\"<br \/>\n ExpiresByType text\/x-javascript \"access plus 1 month\"<br \/>\n ExpiresByType application\/x-shockwave-flash \"access plus 1 month\"<br \/>\n ExpiresByType image\/x-icon \"access plus 1 year\"<br \/>\n ExpiresDefault \"access plus 2 days\"<br \/>\n &lt;\/IfModule&gt;<\/code><\/p>\n<p>\n <\/p>\n<p>If you want to display custom Error Message on common error nubmer 404 the simplest way to set a 404 error page is by directly setting a 404 error message in the .htaccess file itself:<\/p>\n<p><code>ErrorDocument 404 \"SORRY Page not found\"<\/code><code><\/code><\/p>\n<p>or if you have custom Error 404 Like &#8220;404.html&#8221; Page you can simply add the following<\/p>\n<p><code> ErrorDocument 404 \/404.html <\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What .htaccess For .htaccess files (or &#8220;distributed configuration files&#8221;) provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all sub directories some configurations may you add to the file: REMOVE [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":280,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[31],"tags":[32,33],"_links":{"self":[{"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/posts\/357"}],"collection":[{"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/comments?post=357"}],"version-history":[{"count":3,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/posts\/357\/revisions"}],"predecessor-version":[{"id":361,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/posts\/357\/revisions\/361"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/media\/280"}],"wp:attachment":[{"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/media?parent=357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/categories?post=357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xsofthost.com\/help\/wp-json\/wp\/v2\/tags?post=357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}