URL routing and .rss files... thoughts?

This is a discussion on URL routing and .rss files... thoughts? within the PHP General forums, part of the PHP Programming Forums category; I'm using URL routing to display a user's rss feeds. However, these feeds are physically stored in a ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-16-2007
JonnyAJAX
 
Posts: n/a
Default URL routing and .rss files... thoughts?

I'm using URL routing to display a user's rss feeds. However, these
feeds are physically stored in a separate directory.

So when someones goes to say:
http://site.com/users/jon/feed.rss

The URL rounting parses the /users/ /jon/ and feed.rss and currently
redirects to the physical location of the .rss feed.

Is there a way to mask the URL switch so when someone goes to
that .rss link it appears as if the folder and file do in fact reside
in the that directory?

Or perhaps I should read the .rss and output it?

Thoughts?

Reply With Quote
  #2 (permalink)  
Old 06-16-2007
petersprc
 
Posts: n/a
Default Re: URL routing and .rss files... thoughts?

You could use mod_rewrite in the document root .htaccess:

RewriteEngine on
RewriteRule /users/([^/]*)/([^\.*].rss) /otherdir/$1/$2 [L]

If you need more advanced processing, use an internal PHP script, like
so:

http://www.seochat.com/c/a/Link-Trad...-your-Website/

On Jun 16, 1:21 pm, JonnyAJAX <jon.cianciu...@gmail.com> wrote:
> I'm using URL routing to display a user's rss feeds. However, these
> feeds are physically stored in a separate directory.
>
> So when someones goes to say:http://site.com/users/jon/feed.rss
>
> The URL rounting parses the /users/ /jon/ and feed.rss and currently
> redirects to the physical location of the .rss feed.
>
> Is there a way to mask the URL switch so when someone goes to
> that .rss link it appears as if the folder and file do in fact reside
> in the that directory?
>
> Or perhaps I should read the .rss and output it?
>
> Thoughts?



Reply With Quote
  #3 (permalink)  
Old 06-18-2007
JonnyAJAX
 
Posts: n/a
Default Re: URL routing and .rss files... thoughts?

Thanks for the reply!
I can't seem to get it to work though... perhaps if I describe my
desired result you can help me construct the proper .htaccess syntax.

What I need is for anytime a some goes to:
http://mysite.com/users/username => it loads xxx.php

but when someone goes to:
http://mysite.com/users/username/somefeedtitle.rss => it goes to
http://mysite.com/userfiles/username/somefeedtitle.rss

Note that username can be letters, numbers and underscores.

Here's my current .htaccess (which loads router.php all the time):

RewriteEngine On
RewriteRule /users/([^/]*)/([^\.*].rss) /userfiles/$1/$2 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/users/(.*)
RewriteRule . router.php

Reply With Quote
  #4 (permalink)  
Old 06-19-2007
petersprc
 
Posts: n/a
Default Re: URL routing and .rss files... thoughts?

I think the rule may have a typo. Please try:

RewriteRule ^/users/([^/]*)/([^\./]*\.rss)$ /userfiles/$1/$2 [L]

If it doesn't work, try without the rules for router?

On Jun 17, 10:45 pm, JonnyAJAX <jon.cianciu...@gmail.com> wrote:
> Thanks for the reply!
> I can't seem to get it to work though... perhaps if I describe my
> desired result you can help me construct the proper .htaccess syntax.
>
> What I need is for anytime a some goes to:http://mysite.com/users/username=> it loads xxx.php
>
> but when someone goes to:http://mysite.com/users/username/somefeedtitle.rss=> it goes tohttp://mysite.com/userfiles/username/somefeedtitle.rss
>
> Note that username can be letters, numbers and underscores.
>
> Here's my current .htaccess (which loads router.php all the time):
>
> RewriteEngine On
> RewriteRule /users/([^/]*)/([^\.*].rss) /userfiles/$1/$2 [L]
>
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_URI} ^/users/(.*)
> RewriteRule . router.php



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:35 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0