26
votes
Accepted
StartSSL certificate gives SEC_ERROR_REVOKED_CERTIFICATE in Firefox and ERR_CERT_AUTHORITY_INVALID in Chrome
I have some bad news for you. StartSSL's certificates are no longer trusted by Chrome, Firefox, and soon other browsers, beginning with newly issued certificates first. StartSSL won't tell you this of ...
- 2,271
24
votes
Accepted
HTTP Status Code: Response with 101 or 301?
The correct status code to use here is without a doubt 301 Moved Permanently.
101 Switching Protocols is an internal status code that a server generally uses to automatically negotiate certain types ...
- 15.3k
23
votes
Setting X-Forwarded-Proto under Apache 2.4
It's correct to set this directive like
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS}
If it doesn't work, you may need to install and ...
- 331
18
votes
Allowing access to an Apache virtual host from the local network only
People landing in this answer, please note that this is specific for Apache 2.2.
Apache 2.4 has deprecated these directives.
The new way is using the module mod_authz_host and the Require directives....
- 281
15
votes
Accepted
.htaccess syntax multiple RewriteEngine on
Does the order of the code snippets play a role? Is it correct in the above example?
Yes, the order of the directives in Apache config (.htaccess) files can be important. In fact, simply having ...
- 42.2k
12
votes
Accepted
Make Google index over 90,000 user profiles
Sitemaps can be dynamic just like web pages. Just have a PHP script grab those names from the database and make a loop to echo out the XML for each one. Also, make sure you output the proper content ...
- 86k
12
votes
HTTP Status Code: Response with 101 or 301?
No - 101 Switching Protocols is not appropriate for redirecting to HTTPS, as this status indicates that the current connection should be upgraded to the new protocol, whereas a redirect instructs the ...
- 221
9
votes
Accepted
Possible to split virtual host definitions into multiple apache conf files?
You can use the Include directive to include other config files and split up your main config.
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
You can also use wildcards, so you can have each ...
- 42.2k
8
votes
StartSSL certificate gives SEC_ERROR_REVOKED_CERTIFICATE in Firefox and ERR_CERT_AUTHORITY_INVALID in Chrome
StartSSL confirmed that this is because of the partially revoked StartCom root certificate. They are working on getting their root certificate fully trusted by browsers again. It sounds like end of ...
- 96.7k
6
votes
Accepted
Which is more SEO friendly, redirect or rewrite?
It generally makes little difference.
A 301 redirect may cause a short term drop in ranking, but nothing to worry about.
An internal rewrite keeps the same URLs. You just need to be careful that you ...
- 1,614
5
votes
Accepted
Leverage Browser Caching for third party resources
As @TimFountain says, you have "no control" over resources served from a third party. The request goes to the third party server, not your server - so any code you place on your server is ...
- 42.2k
5
votes
Accepted
HTTP2 is enabled and working, but PHP $_SERVER['SERVER_PROTOCOL'] still says "HTTP/1.1"
This has to do with how Cloudflare connects to servers. Although it does serve the client via HTTP2 (or HTTP3), it still connects to the server itself via HTTP1.1.
Cloudflare only uses HTTP/1.x ...
- 545
5
votes
Accepted
RewriteRule started returning 403 Forbidden error
For some reason, without me making any changes, those pages have started returning a 403 Forbidden error.
It's likely the version of Apache has been updated on your server.
I answered a similar ...
- 42.2k
4
votes
Accepted
apache virtual hosts on LAN
Your attempting to access the site using a IP address when your virtual host file is setup to use a domain name, not an IP address... so it'll throw up the default folder, in this case /var/www/html/.
...
- 32.8k
4
votes
Accepted
CSP3 Report-To header implementation
There are examples in the draft of the Reporting-Endpoints directive:
Reporting-Endpoints = endpoint-1="https://example.com/reports"
Your rule is correctly created, as in it returns a valid ...
- 210
4
votes
Accepted
SSL Labs Cipher Strength < 100%, why? How do I make it?
The picture basically depicts two things:
All ciphers listed in SSLCipherSuite in your Apache2 configuration, which are defined as RSA+*, in my case I had RSA+AESGCM256:RSA+AES256:RSA+AES defined, ...
- 373
4
votes
Accepted
Configuring .htaccess to block every request what not image in specified folder and subfolders
I would use mod_rewrite and put this in your main .htaccess near the top, just below RewriteEngine On:
RewriteCond %{REQUEST_URI} ^/u/.*
RewriteRule !\.(png|jpg|jpeg|gif|svg)$ - [R=404,L]
Using a ...
- 96.7k
4
votes
Handling # uri fragments as regular requests
Assuming the file that renders your "one-page" site is index.html and your "pages" are /about, /contact and /help that correspond to elements with ids of the same name (less the ...
- 42.2k
3
votes
.htaccess rewrite but keep basic URL
Unless I'm mistaken, this should be along the lines what you're looking for:
RewriteEngine On
Options +FollowSyminks
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www\....
- 31
3
votes
Accepted
Do you trust timestamps when they are out of order?
This may seem odd, however, there may be a valid explanation.
Apache can log either the access (start) time or the completion time. At one point, when the feature to select access or completion time ...
- 32.7k
3
votes
Make Google index over 90,000 user profiles
A sitemap does not usually help get pages indexed. See The Sitemap Paradox.
To get pages indexed:
You need to link to each page from some other page or preferably multiple other pages.
Include ...
- 96.7k
3
votes
Restrict mod_pagespeed to specific domains on a server
If you can use .htaccess files you can simply set ModPagespeed off in the httpd.conf and then do this in the root .htaccess for any domain you want it enabled on:
<IfModule pagespeed_module>
...
- 131
3
votes
Accepted
WAMPServer 404s a directory URL unless it ends with a trailing slash
I've just noticed @dan's comment above. If /test/ is indeed an Apache Alias, as set by WAMPServer, then the DirectorySlash may not be the problem after all. Both solutions are presented below.
...
- 42.2k
3
votes
Verify 2 cookies with mod_rewrite before serving images
but I'm not sure, if the above RewriteCond's act as X and (Y or Z) or (X and Y) or Z
In the directives you posted it is the former: X and (Y or Z)
However, as mentioned in my comment above, it is ...
- 42.2k
3
votes
Accepted
Are Commercial SSL Certificates (key file, and certificate file) portable when migrating between a new and old Apache2 server?
Certificates are absolutely portable. Just add the Private Key + Certificate + CA/Intermediate Chain to the new server in the same way as the existing server and you shouldn't have any problem.
This ...
- 5,854
3
votes
Using PHP inside .html files not working as expected
<!--?php echo "It works!"; ?-->
This is what you see when you analyse the element using the browsers Object Inspector ie. the interpreted source. This is not the HTML source as sent from the ...
- 42.2k
3
votes
Browser cache persistently expires for images in mod_pagespeed cache
I have found that mod_pagespeed serves images and other resources with a cache expiration of 5 minutes if they are not available in its cache directory (yet). Also, after restarting the Apache ...
- 131
3
votes
Accepted
.htaccess ErrorDocument directive does not catch 404 errors triggered by PHP http_response_code(404)
Presumably in your htaccess rules you also have a rewrite rule to route all requests to Zend Framework. At this point, Apache (and ErrorDocument) isn't really in the picture, as you've told it you ...
- 4,414
3
votes
Accepted
500 internal server error when trying to implement reverse proxy under Apache. How do I forward the requests to another server without errors?
Thanks @MrWhite for giving the correct configuration.
I needed extra module mod_proxy_http and to change the IP adress of server-B to the hostname as I have multiple vHosts on :80.
Here is the ...
- 297
3
votes
Accepted
HTTPS - HTTP communication on the same server
The only solution is to use HTTPS for your AJAX service that is running on example.com:port.
One easy way to make that happen would be to use a reverse proxy on your main server that is already ...
- 96.7k
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
apache2 × 430htaccess × 95
apache × 86
mod-rewrite × 69
redirects × 37
php × 37
https × 37
virtualhost × 36
ubuntu × 27
configuration × 23
httpd.conf × 21
url-rewriting × 20
wordpress × 17
301-redirect × 17
webserver × 16
linux × 15
proxy × 13
security × 11
web-hosting × 10
reverse-proxy × 10
seo × 9
server × 9
security-certificate × 9
403-forbidden × 9
dns × 8