I was working on microsoft environment, but now I moved my website to ubuntu, the problem is, when I try to write a link like this, 127.0.0.1/asd, I get not found error, the thing that makes me crazy is, that URL sometimes work sometimes does not work and It was working great on windows environment, this is the error I get,
Not Found The requested URL /asd was not found on this server.
this is my .htaccess,
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>
RewriteEngine On
RewriteRule ^([//a-zA-Z0-9_-]+)$ tab.php?tab_id=$1 [QSA,L]
Your problem seems to be your rewrite rule - "//" should be "\/" - what does your apache conf file look like, does it have .htaccess enabled for that directory?
Related
I have problems with my local MVC application (website), I am using Lubuntu 18.04 and apache and PHP. I have m3u8 files for HTTP Live Streaming.
This is my .htaccess file :
Header set Access-Control-Allow-Origin "*"
AddType application/x-mpegURL .m3u8
AddType video/MP2T .ts
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !\.(mp3|php|css|js|png|jpg|jpeg|gif|ttf|woff|woff2|eot|mp4|webm|txt|m3u8|ts|M3U8|TS|manifest)$
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
#RewriteCond %{REQUEST_URI} !-l
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
# BEGIN GZIP
<ifmodule mod_deflate.c>
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 image/jpeg
AddOutputFilterByType DEFLATE image/jpg
AddOutputFilterByType DEFLATE image/png
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
</ifmodule>
# END GZIP
This is my php file for the video js hls player :
...
<link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet">
<script src="https://unpkg.com/video.js/dist/video.js"></script>
<script src="https://unpkg.com/videojs-contrib-hls/dist/videojs-contrib-hls.js"></script>
<script type="text/javascript">
var player = videojs('my-video');
player.src({
src: "<? echo $this->url('').'src/app/views/courses/0f5f49dd1829099d48105b3fee7c150e/video3.m3u8'; ?>",
type: 'application/x-mpegURL'
});
player.play();
</script>
...
This is my console in firefox 74:
enter image description here
The m3u8 file is loaded in the page :
enter image description here
I hope that someone has the solution, thank you.
I'm trying to speed up my website. Google insights (https://developers.google.com/speed/pagespeed/insights) tells me that a critical problem is to enable GZip compression.
The address of the site is http://user2.net
It's based on codeigniter framework.
I have enabled gzip compression with folowing changes to my .htaccess file:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
<files *.html>
SetOutputFilter DEFLATE
</files>
I have tested the site with this tool:
http://www.gidnetwork.com/tools/gzip-test.php
It says that gzip is enabled.
What am I missing?
Did you try these lines in your .htaccess?
<IfModule mod_deflate.c>
<FilesMatch "\.(html|php|txt|xml|js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
It works for my site.
First, check if gzip is enable in your server. You can use this tool:
http://checkgzipcompression.com/
If it's ok, then, check that the compression is working FOR ALL your files.
If Google Page Speed Test found on single file without GZIP compression from your server, the website with fail the test.
You can use Google Chrome for this:
Inspect your code; in the image you can see there is Content Encoding GZIP for the html file.
Clic on every file and find which doesn't have the GZIP encode; maybe the CSS type o JS type.
When you find it, add the file type to your gzip.conf
This is the simple configuration for gzip.conf
gzip on;
gzip_disable "MSIE [1-6]\\.(?!.*SV1)";
gzip_proxied any;
gzip_types text/plain text/css text/javascript text/xml application/javascript application/x-javascript application/xml application/xml+rss image/x-icon image/svg+xml image/jpeg image/jpg image/png
gzip_vary on;
Good Luck!
There are three ways to enable gzip compression -
By configuring server settings
For apache -
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
For nginx
gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_vary on;
And by editing .htaccess as shown above
<IfModule mod_deflate.c>
<FilesMatch "\.(html|php|txt|xml|js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
Source: Enable compression
It's the redirect, it sets 2 headers
first 301 (or 302, didn't check)
second 200 + gzip
For anyone who may be having an "Uncompressed Pages" issue after running a SEMRush site audit, try adding the following to your .htaccess
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html|txt|css|js|php)$
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>
Always remember to backup your .htaccess file before making any edits, as a simple typing error could cause certain features of your website to fail or even worse - break your entire website.
Reference: https://www.semrush.com/blog/improve-page-load-times-htaccess-file/
Google has addressed this exact same concern in their FAQ as why would you get the errors to compress/gzip your files.
Checkout from Google's Insights:
https://developers.google.com/speed/docs/insights/EnableCompression#FAQ
Earlier they used to have a chome extension but now it has been removed so they point you to https://developers.google.com/speed/pagespeed/insights/ where when you enter any url, they tell which particular files or scripts are still eligible for compression or blocking the page render or both.
Hope this helps.
i have a linode sever with centos 6 , as it wont support mod_gzip, i am using mod_deflate.
this is my code in .htacess
<IfModule mod_deflate.c>
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
when i tested using http://www.whatsmyip.org/http-compression-test/ , its saying 'my site is gzipped' , but when i used pagespeed in chrome, it still suggest 'Enable compression'
whats wrong? any problem with my .htaccess code?
I used deflate mode in this way:
<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
</IfModule>
And it's working perfectly for me. Pagespeed for my site is:
Desktop: 91
Mobile: 83
References which I have used for my site:
http://www.quickregisterseo.com/improve-google-page-speed-score-wordpress-without-plugins/
https://dzone.com/articles/steps-improve-your-pagespeed-insight-score
I've had this same problem. It seems pagespeed in Chrome sometimes gives the wrong results. I recommend using http://webpagetest.org or http://gtmetrix.com if you really want to be sure. You should always test these sorts of things on different websites, don't just rely on one or two tests. Some websites or tools give the wrong results.
I'm trying to make Gzip compression work on xampp, right now this is in my .htaccess
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
</IfModule>
The HTML file gets compressed, but nothing happens to the JavaScript and CSS files. Anyone know why? How to fix this? (if it's even possible)
Okay... stupid fault... browser still used cached versions...
I have enabled gzip compression for my website via the following in my .htaccess:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xml
This works fine and content is compressed for unencrypted connections, however when secure requests are made nothing is compressed. Any ideas?
My server is running Apache/2.2.14
In your Apache configuration for your secure site (ie the bit where it talks about port 443 and SSL) check that you have enabled the use of .htaccess files with an AllowOverride directive.
It's possible your current AllowOverride directive is within a section pertaining only to the configuration of non-secure, port 80 access to your server.
You should probably RTFM deflation should be negotiated automatically by the server and client at the SSL layer, not the HTTP layer.
C