Hot answers tagged

173

mod_rewrite syntax order mod_rewrite has some specific ordering rules that affect processing. Before anything gets done, the RewriteEngine On directive needs to be given as this turns on mod_rewrite processing. This should be before any other rewrite directives. RewriteCond preceding RewriteRule makes that ONE rule subject to the conditional. Any following ...


29

What is the fundamental format and structure of mod_rewrite rules? I'll defer to sysadmin1138's excellent answer on these points. What form/flavor of regular expressions do I need to have a solid grasp of? In addition to the syntax order, syntax matching/regular expressions, and RewriteRule flags outlined by sysadmin1138, I believe it bears ...


25

This is the cleanest way to do what you want: mutt -a <(mysqldump mysqldumpoptions) admin@example.org The <() operator is what you were asking for; it creates a FIFO (or /dev/fd) and forks a process and connects stdout to the FIFO. >() does the same, except connects stdin to the FIFO instead. In other words, it does all the mknod stuff for you ...


15

Do you mean something like: rewrite ^/component(.*)$ $1 last;


14

Like many admin/developers I've been fighting the intricacies of rewrite rules for years and am unhappy with the existing Apache documentation, so I decided as a personal project to get to the bottom of how mod_rewrite actually works and interacts with the rest of the Apache core, so over the last few months I've been instrumenting test cases with strace + ...


10

Using rewritemap There are lots of things you can do with rewritemaps. Rewritemaps get declared using the Rewritemap directive, and can then be used both in RewritCond evaluations, and in RewriteRule Subsitutions. The general syntax for RewriteMap is: RewriteMap MapName MapType:MapSource For example: RewriteMap examplemap txt:/path/to/file/map.txt ...


9

What are the most common mistakes/pitfalls when writing rewrite rules? A really easy pitfall is when you rewrite URLs that alter the apparent path, e.g. from /base/1234/index.html to /base/script.php?id=1234. Any images or CSS with relative paths to the script location will not be found by the client. A number of options to resolve this can be found ...


8

Add tedswigets.com to your virtual_alias_domains list and then in your virtual file add: @tedswigets.com @tedswidgets.com According to virtual(5) when the result has the form @otherdomain the result becomes the same user in otherdomain. So @tedswigets will catch all anyuser@tedwigets.com emails and the @tedswidgets in the result will cause it ...


7

TLDR; It is not possible to obscure WordPress by only using directives in your .htaccess file. Now cometh a tale of woe and horror. Our friend, fbh was right about the difficulty in hiding WordPress, it be not for yellow-bellied cowards. Arr! Here be the details of this (mis)adventure. Ye be warned! Motivation I'm one of those guys that likes things ...


7

You mean like get-mailbox -Filter { ForwardingAddress -like '*' } | select-object Name,ForwardingAddress ? Or rather "Inbox rules" which your users would have created in Outlook or OWA? The latter should be trickier, but piping $mbox = Get-Mailbox; $mbox | Foreach { Get-InboxRule -Mailbox $_ } (Ryan, thanks for testing and correcting the syntax here) ...


6

stdout is the screen. There isn't a separation between stdout and "the screen". In this instance, I would just redirect stdout to stderr temporarily with 1>&2 within a subshell. This will cause the commands' output to be shown on screen but won't be in the programs stdout stream. #!/bin/bash # the output of these commands shouldn't go to STDOUT, ...


6

I found the answer to this question by more carefully reading the HttpCoreModule docs. port_in_redirect off; This retains the port used by the client during redirects. Closely related is server_name_in_redirect which uses the first hostname for redirects. As I didn't want sitename.v.myserver.com to redirect to sitename.com,


5

That script makes my eye bleed. Get rid of all of the variables storing fragments of the command (and the unnecessary input redirect on the grep), and see where that gets you. The quoting is almost certainly screwed up in ways you don't even want to imagine. In bourne shell, I'd write something like this: today="$(date +"%m\/%d\/%y")" filetoday="$(date ...


5

Configure your server to issue an HTTP 301 response to map the one to the other, eg using Redirect with Apache.


5

You can exclude each sub1, sub2 individually like so; <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^sub1\.domain\.com [NC] RewriteRule ^(.*) - [L] RewriteCond %{HTTP_HOST} ^sub2\.domain\.com [NC] RewriteRule ^(.*) - [L] RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC] RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301] ...


5

You need MX records. Period. There may be tricks if they currently don't go to google apps to redirect your mail. But it has to go somewhere to start with. If your host really doesn't let you set MX records (which is unlikely) transfer your domain to someone who does.


5

Strict-Transport-Security - includeSubdomains The problem is the scope of the HSTS header, it includes all subdomains. If accessing http://demo.xml-director.info with a browser first it'll work fine. However, upon first access to https://xml-director.info/ or https://www.xml-director.info the browser will receive a HSTS header for all subdomains set to ...


5

Remeber 8.8.8.8 is an anycast address. You can basically do the exactly same thing Google does for maintaining one of their boxes that serve the 8.8.8.8 traffic. Assign the IP address 8.8.8.8 as an additional address on the DNS server, and Possibly add a route if necessary directing 8.8.8.8/32 directing the traffic to your that DNS server.


5

You cannot solve this without getting new SSL certificates. Redirection won't help, since the SSL certificate is getting checked before the actual HTTP session starts. ETA So you need new certificates, either wildcard ones or ones with Subject Alternate Names (SAN), which are valid for a list of DNS names instead of just one. EOE If it had been possible to ...


4

I think the most important thing to note is that the actual redirection that you describe will not be done in DNS. You could do something like this (minimally): example.com. IN A 178.62.87.73 *.example.com. IN A 178.62.87.73 However, not having an explicit record for the actual name you intend to use is not all that clear to fellow ...


4

If you want to allow legitimate SSH logins while disallowing (via honeypot) fake, I'd change tack. Put your SSHD on another port, like 2323 or some other oddball port, and forward connections to that. Ideally you have a separate machine for that, so you can tell your router to forward port 2323 to internal machine XYZ port 22. Open port 22 to be forwarded ...


4

To address your question about disconnected computers (laptops/notebooks) being joined to the domain. This is very common. When disconnected from the domain, those users who use domain joined laptops/notebooks will log on to the laptops with cached credentials for their domain user accounts (so long as they've logged onto the domain at least once while ...


4

First of all, you specify a rule to match all requests (.*), then you add a condition for a specific url. You should have your limiting criteria in the match: <match url="^/foo_bar/(.*)" /> then you don't need the condition anymore. You use conditions only for additional criteria not based on the URL. Secondly {R:1} refers back to the whole url ...


4

A user profile exists whenever a user is logged into Windows. On recent versions of Windows it is the files under C:\Users\%USERNAME%, on older versions of Windows it was C:\Documents and Settings\%USERNAME%. It has the documents and settings associated with a user. A home directory is typically a network location that is automatically mapped that is ...


4

If you are trying to hide that you are using wordpress because of crackers, then you really got some work to do. If you do the wp* trick, what about wp-content and wp-includes? Without being able to reach those, you will break the page and it will look horrible. Also, there are so many things in Wordpress that this really takes some work - and you will ...


4

DNS isn't the tool to use to solve this. You can do this with an active/passive load balancer, but if you were going to do this, you might as well just make them both public facing and active/active. What is the business case for having an internal redirect instead of using a real HA solution?


4

Why can't you just setup a .htaccess file (with a 301 redirect) in the folder that the subdmain is in. For Example: Create a .htaccess file in the folder example.org/subdomain Setup your subdomain in Cpanel based on the above folder Edit that new .htaccess file and add the following code Redirect 301 / http://somethingelse.com With / being the root ...


4

Set your DNS MX record for the new short domain to be the same as for your full long name. Configure your mail server to host both Create rewrite rule to rewrite @shortname as @longname


4

use scriptable ftp client like lftp. you use it like this: lftp -u login,pass host.com -e "get file.txt;exit " or even simpler - use wget: wget -O file ftp://login:pass@host.com/file.txt


4

Name servers do not route anything. Name servers respond to requests for names, and they eventually returns an IP. CNAME records return a name, which is then looked up to get the IP. The only thing you really can do with your DNS records is make sure that your name is set returns the IP address of a server that will accept the traffic and do what you ...



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