Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I asked this question on stackoverflow.com: http://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-namehttps://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-name

Sorry for redirecting, but I wasn't aware of webmasters.stackoverflow and wasn't sure if I should repost it here or just link to it to prevent duplication.

UPDATE

Here's what I have so far:

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

This is redirecting everything, including example.com alone. I only want the redirect to happen if there is something (anything) after the ".com" (i.e. "/whatever"). I have a static HTML page that is now at example.com, but I want my old DB-backed site to go to archived.example.com.

Anymore ideas?

I asked this question on stackoverflow.com: http://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-name

Sorry for redirecting, but I wasn't aware of webmasters.stackoverflow and wasn't sure if I should repost it here or just link to it to prevent duplication.

UPDATE

Here's what I have so far:

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

This is redirecting everything, including example.com alone. I only want the redirect to happen if there is something (anything) after the ".com" (i.e. "/whatever"). I have a static HTML page that is now at example.com, but I want my old DB-backed site to go to archived.example.com.

Anymore ideas?

I asked this question on stackoverflow.com: https://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-name

Sorry for redirecting, but I wasn't aware of webmasters.stackoverflow and wasn't sure if I should repost it here or just link to it to prevent duplication.

UPDATE

Here's what I have so far:

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

This is redirecting everything, including example.com alone. I only want the redirect to happen if there is something (anything) after the ".com" (i.e. "/whatever"). I have a static HTML page that is now at example.com, but I want my old DB-backed site to go to archived.example.com.

Anymore ideas?

Update including the rewrite rules in my config...
Source Link
rpheath
  • 143
  • 4

I asked this question on stackoverflow.com: http://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-name

Sorry for redirecting, but I wasn't aware of webmasters.stackoverflow and wasn't sure if I should repost it here or just link to it to prevent duplication.

UPDATE

Here's what I have so far:

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

This is redirecting everything, including example.com alone. I only want the redirect to happen if there is something (anything) after the ".com" (i.e. "/whatever"). I have a static HTML page that is now at example.com, but I want my old DB-backed site to go to archived.example.com.

Anymore ideas?

I asked this question on stackoverflow.com: http://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-name

Sorry for redirecting, but I wasn't aware of webmasters.stackoverflow and wasn't sure if I should repost it here or just link to it to prevent duplication.

I asked this question on stackoverflow.com: http://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-name

Sorry for redirecting, but I wasn't aware of webmasters.stackoverflow and wasn't sure if I should repost it here or just link to it to prevent duplication.

UPDATE

Here's what I have so far:

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

This is redirecting everything, including example.com alone. I only want the redirect to happen if there is something (anything) after the ".com" (i.e. "/whatever"). I have a static HTML page that is now at example.com, but I want my old DB-backed site to go to archived.example.com.

Anymore ideas?

deleted 34 characters in body
Source Link
Su'
  • 19.3k
  • 3
  • 41
  • 65

I asked this question on stackoverflow.com: http://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-name

Sorry for redirecting, but I wasn't aware of webmasters.stackoverflow and wasn't sure if I should repost it here or just link to it to prevent duplication.

Thanks for any help on this.

I asked this question on stackoverflow.com: http://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-name

Sorry for redirecting, but I wasn't aware of webmasters.stackoverflow and wasn't sure if I should repost it here or just link to it to prevent duplication.

Thanks for any help on this.

I asked this question on stackoverflow.com: http://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-name

Sorry for redirecting, but I wasn't aware of webmasters.stackoverflow and wasn't sure if I should repost it here or just link to it to prevent duplication.

Source Link
rpheath
  • 143
  • 4
Loading