Register or Login to browse without ads

Thu 2 Sep 2010 - 5:17 pm UTC

Home | Ask a Question | Browse Questions

CANCELLED

Question: htaccess: Redirect everything but 1 file

Home » Technology » #563

Please carefully read the Disclaimer and Terms & conditions.
Priced at $10.00

Actions: Add Comment

Asked by j_philipp on Tue 3 Jul 2007 - 11:21 am UTC:

I want to redirect all my pages except one called "rss.xml" from domain
example-old.com to domain example-new.com (well, these are sample domains
for this question). The following redirects all:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://example-new.com/$1 [R=301,L]

How do I change this so "rss.xml" will "remain" on the old server ('cause I
want to keep it there for some hours, for old RSS readers to catch up)?

Comment by User autobotr on Tue 3 Jul 2007 - 11:32 am UTC:

Instead of editing your htaccess file you could simply use
http://www.feedburner.com to handle your feed

If you prefer the htaccess way, 

RewriteEngine on
RewriteCond $1 !^path/to/your/rss.xml
RewriteRule (.*) http://www.example-new.com/$1 [R=301,L] 

Hope this helps

Best Regards
Autobotr

Comment by User autobotr on Tue 3 Jul 2007 - 11:38 am UTC:

Please note that in my previous message, "path/to/your/rss.xml" should be
the full path to your old domain address ie http://yourdomain.com/rss.xml

If you chose to use feedburner instead, the full path is
http://feedburner.com/yourusername

Lastly, are you using a blogging software such as Wordpress? There are
plugins that will facilitate your blog to use feedburner as the default
feed. 

Comment by j_philipp on Tue 3 Jul 2007 - 11:43 am UTC:

Thanks. But weird, this doesn't seem to work -- it will redirect
everything, including "rss.xml". Please note that the full path of rss.xml
is "http: //www.example-old.com/rss.xml" , so maybe it being in the top
level changes some syntax?

Comment by User autobotr on Tue 3 Jul 2007 - 11:54 am UTC:

Did you leave a space between "http:" and "//" 
http: //www.example-old.com/rss.xml 

If so remove the space and try again. The idea I get is that your current
software could be overwriting your htaccess redirect to the old feed. In
this case feedburner would be the better solution. It is free so please try
it out. 

Could you indicate the type of publishing software you're using? I could
better advise you on the more efficient method if I know which software it
is. 

Comment by j_philipp on Tue 3 Jul 2007 - 12:52 pm UTC:

No, I just used the space here so that this wouldn't auto-link.

Comment by j_philipp on Tue 3 Jul 2007 - 12:53 pm UTC:

I'm using a text editor dabbling the htacces file on my Apache (for
everything else I'm using PHP5).
Now that the domain move went we can replace example-old with
blog.outer-court.com and example-new with blogoscoped.com :)

Uclue Researcher Request for clarification by Researcher admin on Tue 3 Jul 2007 - 3:19 pm UTC:

Hi philipp,

Will you try this please?

RewriteEngine on
RewriteCond $1 !^rss.xml
RewriteRule ^/(.*) http://blogoscoped.com/$1 [R=301,L]

If that doesn't work, and if you only have one rss.xml at
blog.outer-court.com, please take out the circumflex:

RewriteEngine on
RewriteCond $1 !rss.xml
RewriteRule ^/(.*) http://blogoscoped.com/$1 [R=301,L]

(just in case you have some Alias directives messing with the URL)

Question clarification by j_philipp on Tue 3 Jul 2007 - 3:37 pm UTC:

Thanks Admin but those two didn't work... what it did was create a
"forbidden" reply from anything on blog.outer-court.com instead of a
redirect, though the rss.xml was indeed found.

Comment by User autobotr on Tue 3 Jul 2007 - 5:39 pm UTC:

What a surprise, Philipp from google blogoscoped? I was just reading your
last entry about feedburner when it dawned on me that I just referred some
philipp guy on uclue to use feedburner a few hours ago. Could it be the
same person I wondered. :-)

Comment by j_philipp on Thu 12 Jul 2007 - 10:27 am UTC:

I got it solved now differently. I cleared the folder of contents, and I'm
putting this line in the htaccess file...

ErrorDocument 404 /404.php5

And the following in the PHP:

<?

header('HTTP/1.1 301 Moved Permanently');
header('Location: http://blogoscoped.com' . $_SERVER['REQUEST_URI']);

?>

As only the rss.xml will now be found (and not redirected), that does the
job.

Cancelled by j_philipp on Thu 12 Jul 2007 - 10:27 am UTC:

thanks!

Actions: Add Comment

Bookmark it!   Del.icio.us Digg Furl Reddit Yahoo MyWeb StumbleUpon Technorati Mixx MySpace Facebook

Frequently Asked Questions | Terms & Conditions | Disclaimer | Privacy Policy | Contact Us | Spread the word!

© 2010 Uclue Ltd