Skip to main content
revised answer after OP said my previous answer helped him out!
Source Link
Nathan
  • 381
  • 1
  • 5

The RewriteCond %{REQUEST_URI} ^/(.+)$ matches all characters after the /

(.+) is a regular expression that matches any character.

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(\s+)$[a-zA-Z0-9\/-]+$
RewriteRule /(.*) http://archived.example.com/$1

The above might do it, but I'm not very good with regular expressions.

(\s+)[a-zA-Z0-9\/-]+ will match a series of any non-whitespace character. Thinking about this now,of the above probably wouldn't work because it'll matchcharacters in the domain name afterbrackets following the trailing \/.

I use RegExLib as my cheat-sheet. I've looked around there forIt'll also let you test regular expressions against a solution to your question, but haven't found anything...source But, I've answered your first question! "Why is this mod_rewrite redirecting my domain?"

I'll have another look after I eat(to see what matches).

The RewriteCond %{REQUEST_URI} ^/(.+)$ matches all characters after the /

(.+) is a regular expression that matches any character.

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(\s+)$
RewriteRule /(.*) http://archived.example.com/$1

The above might do it, but I'm not very good with regular expressions.

(\s+) will match a series of any non-whitespace character. Thinking about this now, the above probably wouldn't work because it'll match the domain name after the \.

I use RegExLib as my cheat-sheet. I've looked around there for a solution to your question, but haven't found anything... But, I've answered your first question! "Why is this mod_rewrite redirecting my domain?"

I'll have another look after I eat.

The RewriteCond %{REQUEST_URI} ^/(.+)$ matches all characters after the /

(.+) is a regular expression that matches any character.

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/[a-zA-Z0-9\/-]+$
RewriteRule /(.*) http://archived.example.com/$1

The above might do it, but I'm not very good with regular expressions.

[a-zA-Z0-9\/-]+ will match a series of any of the characters in the brackets following the trailing /.

I use RegExLib as my cheat-sheet. It'll also let you test regular expressions against a source (to see what matches).

added 293 characters in body
Source Link
Nathan
  • 381
  • 1
  • 5

The RewriteCond %{REQUEST_URI} ^/(.+)$ matches all characters after the /

(.+) is a regular expression that matches any character.

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(\s+)$
RewriteRule /(.*) http://archived.example.com/$1

The above might do it, but I'm not very good with regular expressions.

(\s+) will match a series of any non-whitespace character. Thinking about this now, the above probably wouldn't work because it'll match the domain name after the \.

I use RegExLib as my cheat-sheet. I've looked around there for a solution to your question, but haven't found anything... But, I've answered your first question! "Why is this mod_rewrite redirecting my domain?"

I'll have another look after I eat.

The RewriteCond %{REQUEST_URI} ^/(.+)$ matches all characters after the /

(.+) is a regular expression that matches any character.

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(\s+)$
RewriteRule /(.*) http://archived.example.com/$1

The above might do it, but I'm not very good with regular expressions.

(\s+) will match a series of any non-whitespace character. Thinking about this now, the above probably wouldn't work because it'll match the domain name after the \.

The RewriteCond %{REQUEST_URI} ^/(.+)$ matches all characters after the /

(.+) is a regular expression that matches any character.

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(\s+)$
RewriteRule /(.*) http://archived.example.com/$1

The above might do it, but I'm not very good with regular expressions.

(\s+) will match a series of any non-whitespace character. Thinking about this now, the above probably wouldn't work because it'll match the domain name after the \.

I use RegExLib as my cheat-sheet. I've looked around there for a solution to your question, but haven't found anything... But, I've answered your first question! "Why is this mod_rewrite redirecting my domain?"

I'll have another look after I eat.

added 236 characters in body
Source Link
Nathan
  • 381
  • 1
  • 5

The RewriteCond %{REQUEST_URI} ^/(.+)$ matches all characters after the /

(.+) is a regular expression that matches any character.

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(\s+)$
RewriteRule /(.*) http://archived.example.com/$1

The above might do it, but I'm not very good with regular expressions.

(\s+) will match a series of any non-whitespace character. Thinking about this now, the above probably wouldn't work because it'll match the domain name after the \.

The RewriteCond %{REQUEST_URI} ^/(.+)$ matches all characters after the /

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(\s+)$
RewriteRule /(.*) http://archived.example.com/$1

The above might do it, but I'm not very good with regular expressions.

The RewriteCond %{REQUEST_URI} ^/(.+)$ matches all characters after the /

(.+) is a regular expression that matches any character.

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(\s+)$
RewriteRule /(.*) http://archived.example.com/$1

The above might do it, but I'm not very good with regular expressions.

(\s+) will match a series of any non-whitespace character. Thinking about this now, the above probably wouldn't work because it'll match the domain name after the \.

Source Link
Nathan
  • 381
  • 1
  • 5
Loading