Tag Info

Hot answers tagged

3

For wamp 2.5 on Windows, use a text editor, e.g. notepad++ to edit c:\wamp\bin\apache\apache2.4.9\conf\httpd.conf Change DocumentRoot "c:/wamp/www" to DocumentRoot "c:/my/new/path" (Note slash direction). This will change the location where files are served from (~Line 230). Change <Directory "c:/wamp/www"> to <Directory "c:/my/new/path"> ...


3

You're much better off doing a redirect from non-www to www. There is no need for canonical and no need for Javascript. If you have apache with mod_rewrite installed, then in the main apache configuration file, you can add these lines: RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] Of ...


3

If you're getting alot of requests with undefined added to the URLs and you know the things accessing those URLs are people and not robots, you're much better off using HTTP status code 301 and redirecting the URL to the correct one. Using status code 204 will not help because it means "No content" and the user will then need to manually modify the URL in ...


3

In order to match "undefined" at the end of the URL-path you need the regex pattern undefined$. The pattern ^undefined$ (which you've used in your question) matches the exact URL "undefined", which is never going to match, unless the request is for http://example.com/undefined. This directive should go at the top of your .htaccess file (after the ...


2

Try using the mod_expires syntax using something like this: <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access 2 week" ExpiresByType image/jpeg "access 2 week" ExpiresByType image/gif "access 2 week" ExpiresByType image/png "access 2 week" ExpiresByType text/css "access 2 week" ExpiresByType text/html "access 1 hour" ...


2

But the Official documentation clearly states it is used only for the RewriteRule directive. The docs don't say that it can only be used on the RewriteRule directive. The page you link to (which incidentally is specifically about the RewriteRule flags) simply states: Use of the [NC] flag causes the RewriteRule to be matched in a case-insensitive ...


2

First off the easiest one for www is this. RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^yourwebsite\.com$ [NC] RewriteRule ^(.*)$ http://www.yourwebsite.com/$1 [R=301,L] Now for some actual rewriting you should be able to use something like this. RewriteCond $1 !^(users) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d ...


2

Apache and Lighthttpd both have a directory listing mod that you need to enable, often by default these are disabled for security reasons. You can enable indexing by doing the following: Lighthttp To enable directory listings globally: dir-listing.activate = "enable" If you need it only for a directory, use conditionals: $HTTP["url"] =~ ...


2

You seem to have 2 A records for example.com pointing to very different IP addresses, one of which is the one that www.example.com resolves to (which is the wrong one). My guess is that it's picking the first one that it finds!?


1

There are many technical reasons for using www over no-www, the most obvious one is no-www's cookies are sent to all subdomains, which will slow down static content even if you use static. subdomain. More details here: http://www.yes-www.org/why-use-www/ As for why your no-www is really slow, it depends on many factors, your sysadmin got to diagnose it. ...


1

Just as a matter of explanation for future users. Your 000-default.conf file is a catch-all site and should be left alone. It is good for security. It can be frustrating when a site configuration does not work and the default site is served. I get it. Still, leave it alone. Many people are unaware of why the default site exists. Here is a bit of an ...


1

The file 000-default.conf in /etc/apache2/sites-available/ defines the /var/www/html/ folder as the webroot (this is enabled by default, as you can see in the /etc/apache2/sites-enabled/ folder): <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is ...



Only top voted, non community-wiki answers of a minimum length are eligible