Tag Info

New answers tagged

0

The space is a delimiter (ie. a special character) in .htaccess so must be backslash escaped if you want to match a literal space in the regex. Eg. DV\ CRAWLER. (Otherwise you are likely to get a less than helpful 500 Internal Server error.) Or, you can use the shorthand character class \s which matches any white space character (space, tab or new line / ...


0

When in doubt, add parenthesis and escaping to regular expressions. Try this first: (Baiduspider|(DV CRAWLER)) I think that your problem is that it evaluating as "Baiduspider or DV followed by CRAWLER" when you don't have the paranthesis. If that doesn't work, then try escaping the space: (Baiduspider|(DV\sCRAWLER)) Where \s is any white space ...


1

Your regex code in general is wrong. Try instead something like this: RewriteCond %{HTTP_USER_AGENT} (.*Baiduspider.*|.*DV.*CRAWLER.*) [NC] You are matching against a string in each iteration between the parenthesis () separated by the pipe character | whereas .* is a wild card that matches anything. Optionally you can use \s or \s+ for spaces but .* ...


1

Yes, this is easy enough and a real time saver as the number of sites you manage increases. In the /etc/nginx/conf.d/ directory, create one or more '.conf' files with the reusable config snippets you need. For example, type sudo nano /etc/nginx/conf.d/headers.conf and put your headers in the file. The default nginx.conf has a wildcard include directive at ...


0

After a while researching and experimenting I've managed to find solution: Install plugin Permalink Fix & Disable Canonical Redirects Pack; Change the location / block in my config (the one I posted above) like that: location / { try_files $uri $uri/ /index.php?q=$uri&$args; }


1

I'm always setup 301 redirect from www.example.com domain to example.com. This code helps you: server { server_name www.example.com; return 301 $scheme://example.com$request_uri; }


2

I would think this would be the expected behaviour would be this instead: www.example.com -> example.com www.example.com/test.html -> example.com/test.html That's a good idea. Just map the last parts of the URL (particularly folder and file) from the old domain to the new domain. You can easily use mod-rewrite if you have apache. Just make an ...


3

The HTTP status code 301 is named "Moved Permanently": The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. So the resource (i.e., your document) would stay the same, it just gets a new URI. As your front page http://example.com/ is (usually) not the same resource ...



Top 50 recent answers are included