Search the Community
Showing results for tags '.htaccess'.
-
I would like to ask if it is possible to put in the .htaccess a configuration for allowing or denying a specific address/all for viewing the website.Because I think I tried but I guess it didn't work.
-
Note: This is only one of the many ways to implement caching. This in my opinion the easiest and the one that works for me. This is my method on how to easily Implement Caching Headers in .htcaccess. Now some of you must be wondering. What in the world is caching. Caching is a way to speed up your site by preloading the site so that it can be delivered to you faster. What that means is that instead of doing the complex calculations of generating a website every time, they can just deliver you a saved copy. Kind of like making more products than your customers ordered so when another customer orders the product, you won't have to make it from scratch, you just need to deliver the premade product to them. So with no further due, lets get started. Before we start, here is a Gtmetrix test for my website before implementing these caching headers. Not to shabby, but we can make it better. To implement caching headers you would need to go to the cPanel file manager or connect via ftp. Then you would need to open the .htaccess file. If you don't see one, make sure to go to settings and show hidden files. If you don't have one, you can just create it. Then paste in this code: <IfModule mod_expires.c> ExpiresActive On # Images ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType image/webp "access plus 1 year" ExpiresByType image/svg+xml "access plus 1 year" ExpiresByType image/x-icon "access plus 1 year" # Video ExpiresByType video/webm "access plus 1 year" ExpiresByType video/mp4 "access plus 1 year" ExpiresByType video/mpeg "access plus 1 year" # Fonts ExpiresByType font/ttf "access plus 1 year" ExpiresByType font/otf "access plus 1 year" ExpiresByType font/woff "access plus 1 year" ExpiresByType font/woff2 "access plus 1 year" ExpiresByType application/font-woff "access plus 1 year" # CSS, JavaScript ExpiresByType text/css "access plus 1 month" ExpiresByType text/javascript "access plus 1 month" ExpiresByType application/javascript "access plus 1 month" # Others ExpiresByType application/pdf "access plus 1 month" ExpiresByType image/vnd.microsoft.icon "access plus 1 year" </IfModule> Done, it is that easy. Now if you want, you can edit the code to your preference but that is optional. Now take a look at the exact same website after implementing that caching methods. As you can see my website (without any changes) loaded TWICE as fast as before. If your homepage has changed and you want to clear the cache. Just replace the code above with this code: # DISABLE CACHING <IfModule mod_headers.c> Header set Cache-Control "no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires 0 </IfModule> <FilesMatch "\.(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|mp3|mp4|png|pdf|swf|txt)$"> <IfModule mod_expires.c> ExpiresActive Off </IfModule> <IfModule mod_headers.c> FileETag None Header unset ETag Header unset Pragma Header unset Cache-Control Header unset Last-Modified Header set Pragma "no-cache" Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT" </IfModule> </FilesMatch> Save the file and wait a few minutes (5 - 30 minutes). Then just replace the .htaccess file with the original caching code.
-
compression is not working for me, i added the code below to the .htaccess files and no effect, so i wonder if its enabled on the server. so i need it on and enabled. AddOutputFilterByType DEFLATE application/atom+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/json AddOutputFilterByType DEFLATE application/ld+json AddOutputFilterByType DEFLATE application/manifest+json AddOutputFilterByType DEFLATE application/rdf+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/schema+json AddOutputFilterByType DEFLATE application/vnd.geo+json AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE application/x-font-ttf AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/x-web-app-manifest+json AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE font/eot AddOutputFilterByType DEFLATE font/opentype AddOutputFilterByType DEFLATE image/bmp AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE image/vnd.microsoft.icon AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE text/cache-manifest AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/vcard AddOutputFilterByType DEFLATE text/vnd.rim.location.xloc AddOutputFilterByType DEFLATE text/vtt AddOutputFilterByType DEFLATE text/x-component AddOutputFilterByType DEFLATE text/x-cross-domain-policy AddOutputFilterByType DEFLATE text/xml i added this to the .ht file with no effect. before this i was using this script above with `&--#60;IfModule mod_filter.c&--#62;` and `&--#60;/IfModule&--#62;` at the end, untill i notice the apache verison notice below, by adding only `AddOutputFilterByType` as seen above to the .htaccess file on the server. as my Apache version is 2.2.16 on heliohost; still no effect. i need help, else if not activated on the root, please do. # Compress all output labeled with one of the following media types. # # (!) For Apache versions below version 2.3.7 you don't need to # enable `mod_filter` and can remove the `&--#60;IfModule mod_filter.c&--#62;` # and `&--#60;/IfModule&--#62;` lines as `AddOutputFilterByType` is still in # the core directives. # # https://httpd.apache...putfilterbytype obviously the apache mod_deflate module may not be enabled on the server. thank you and pls do treat as urgent.
- 2 replies
-
- compression
- .htaccess
-
(and 1 more)
Tagged with:
-
my website is softmandu.heliohost.org I am getting this error: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@softmandu.heliohost.org and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/0.9.8e-fips-rhel5 mod_mono/2.6.3 mod_jk/1.2.37 mod_bwlimited/1.4 mod_wsgi/4.4.13 Python/2.4.3 Server at softmandu.heliohost.org Port 80
-
I'm working on setting my webpage up with a single index.php file that injects HTML into itself from header.php, footer.php, content.php, etc. And I want to rewrite the URL depending on what content is loaded into the main container. So after header.php, it would load content.php, and the PHP script will be setup to search based on which menu item was clicked for a stub like "/content/stub/latest-news-1.html" and inject the file name into the <div name=" ">, and the HTML contents between the <div> tags. The injected HTML would be something like: <div id="main-container" style="main-style" name="latest-news"><p>Some info goes here</p></div> ... and another script to write the URL as "example.com/latest-news/1/". But whithout changing the .htaccess contents, the URL rewrite script in PHP will make the URL look like "example.com/index.php?/latest-news/1/" What I need to do is modify the .htaccess file to rewrite "index.php" as "/". The trouble is, HelioHost, like a lot of other host companies, hide the .htaccess file from the File Manager as well as from FTP. You can't upload .htaccess directly to the root folder without an error telling you the file already exists. But you can upload sample.htaccess to a sub-folder, rename it to .htaccess, then move it to the root folder - overwriting the previous file. But not having access to the original .htaccess file, I don't want to replace it with a version that removes needed instructions found in the original. Can someone please post the original .htaccess file contents, or at least the settings (if any) that may affect site functionality so I don't accidentally cripple my page?
- 2 replies
-
- RewriteEngine
- URL masking
-
(and 2 more)
Tagged with:
-
I need some help here. If i type http://nevski.heliohost.org i get redirected to http://nevski.heliohost.org/cgi-sys/defaultwebpage.cgi . And when i type http://www.nevski.heliohost.org I get to a place where i want to go "public_html" So how can i make a link without www. to go to "public_html" . Thanks in Advance, Lazar
-
Hi, Im trying to create a django powered website. As mentioned in the help topics, I have setup the .htaccess and .python_egg_cache files. But for some reason I can't edit the files once I created them. Any idea on how to edit them after I create them? Thanks in advance... Sorry Got it, missed the checkbox allowing you to view and edit hidden files
-
I have some problems with my .htaccess file. I've tried placing the .htaccess file in my very root and in the folder I actually want it in, but I keep getting a 500 error. Once I delete the file the problem is gone. This is the piece of code I'm using: -- Options +FollowSymlinks RewriteEngine on RewriteRule ^edit/([^/]+)/([^/]+) /edit.php?cat=$1&id=$2 [NC] -- And I've also tried this: -- RewriteEngine on RewriteRule ^edit/([^/]+)/([^/]+) /edit.php?cat=$1&id=$2 [NC] -- Is this just an error in my script, is this functions turned off somehow, or... could anyone help me?