Tag Info

New answers tagged

1

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

I personnaly use this: RewriteEngine on RewriteCond %{HTTP_HOST} !\..+\. RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L] It checks if there is NOT 2 dots in the domain name. This is very similar to what w3d proposed, I just find it more readable. And as w3d stated, it is impossible to have a fully generic solution because nothing allow to guess how ...


3

I don't think you can make it completely generic, since you'll need to make exceptions for your subdomains, unless there is a pattern to your subdomains? A workaround is to add each subdomains to the regular expression. Well, yes unfortunately... RewriteEngine on RewriteCond %{HTTP_HOST} !^(wiki|sub2|sub3)\. RewriteCond %{HTTP_HOST} ^(?!www\.)(.+) ...


2

redirect 301 http://m.somesite.com/site/somesite/faqs http://www.somesite.com/faqs/ This doesn't work because the source URL needs to be a URL-path, starting with a slash (as you have used for the redirects that work), not an absolute URL. In other words, it should be written as the following (in a .htaccess file located at the subdomains document ...


0

If your canonical tag points to the URL with the extension then is what search engines will cache and index. So the URL with the extension will be in the search results. But you have to ask yourself this, If search engines cannot see any internal links with the exception of the canonical URL on your site, what value would they place on a page if the site ...


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 ...


0

Spam is not new. But the only thing you can really do is install a captcha system. This means that for every post someone makes on your website, they have to enter a special code that is displayed on screen inside an image. Robots can't see this and since most spam comes from robots, you'll probably do a good job filtering out most robots. If some try to ...


0

Your W3 Total Cache and .htaccess on the main domain will not work on your sub domains. Copy across your main URLs htaccess caching code to the sub domains and see how that responds. @WilliamHarvey


0

Turns out Options -Indexes on root htaccess will disable indexing for its sub folder. Case closed.


0

It looks like you are just missing the OR flag: RewriteCond %{HTTP_HOST} ^example\.co\.uk [NC,OR] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.co.uk/$1 [R,L] Either the bare domain is accessed OR you are accessing via HTTP then redirect. The default operator is to AND the conditions. Also, escape the dots in your regex. Change R ...


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 ...


0

Finally, I have not hash a password to md5 .... I've used notepad ++ and I put the password in simple character I followed this tutorial with the linux command for create file htaccess now my content of my htpasswd : admin:$apr1$Oy4JMDb0$yb00PbzV9mrq07lPivrzL1


1

From your comment I take it that you just created a plain text password. This will not work for Apache, as Apache expects the password in .htpasswd to be hashed by the MD5 algorithm. There are several tools available online for generating .htpasswd files, but the easiest might be the one that comes with Apache, it's called htpasswd. On RHEL (Fedora, Red ...


1

Make sure that you are including the entire path for AuthUserFile. I would suggest that you create a protected directory instead of doing this on the root directory. I made sure and tested these configurations to ensure that they worked. File Locations /protected/.htaccess /protected/.htpasswd .htaccess File AuthType Basic AuthName "restricted area" ...


0

This looks like there has been a change in the way PHP is being run on the server. Either because the host has updated/migrated the server or because of a user configuration change. Some hosts allow the user to change the version of PHP being run via an option in cPanel. AddHandler fcgid-script .html FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .html This ...



Top 50 recent answers are included