Forum Moderators: phranque

Message Too Old, No Replies

.htaccess redirect regular expressions

redirecting few files to their folder

         

harvinder

6:13 pm on Aug 3, 2008 (gmt 0)

10+ Year Member



I am trying to redirect some of the pages on my website but these pages are placed all over the place. I would like to redirect the user to its respective folder, where an index file is already serving the purpose i.e.

user types: http://www.example.com/multimedia/rock/playlist.xml
redirect to: http://www.example.com/multimedia/rock/

user types: http://www.example.com/multimedia/rock/1/2/3/1/playlist.xml
redirect to: http://www.example.com/multimedia/rock/1/2/3/1/

user types: http://www.example.com/multimedia/rock/1/anotherfolder/3/1/playlist. xml
redirect to: http://www.example.com/multimedia/rock/1/anotherfolder/3/1/

and so on. As you have guessed, I am trying to redirect access from playlist.xml files to their respective folders. this is because my playlists are being indexed in the google and users wold not be able to understand them because these files only contain links in a text format. Also I do not wish to block these playlist from being indexed because more search results are matching my website because of these playlist.xml files.

I would really appreciate if someone could provide me with a sort of regular expression that can be applied.

[edited by: encyclo at 6:40 pm (utc) on Aug. 3, 2008]
[edit reason] switched to example.com [/edit]

g1smd

6:32 pm on Aug 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Once you redirect URL requests for playlist.xml, nothing will be able to index them, and they will no longer appear in the search results.

You can't have a URL that directly serves content as well as being a redirect. It can only be one or the other.

harvinder

7:03 pm on Aug 3, 2008 (gmt 0)

10+ Year Member



Thanks g1smd, it makes sense because once the redirect is in place google will simply stop indexing those pages and stop generating results match theseplaylist. Now I end up in another problem, what should be done to help visitors get meaningfull information out of these files?

I was wondering more in the lines of providing a better stylesheet for the xml document. If you have other ideas please let me know.

g1smd

8:21 pm on Aug 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There must be a way of transforming XML data into some sort of meaningful HTML layout.

Isn't that what XSLT and XSL are for? Sorry, not an area that I play with.

harvinder

8:41 am on Aug 4, 2008 (gmt 0)

10+ Year Member



Yes I am in the process of doing that using XSL stylesheets. I was just wondering if there is any other option left for me other than manipulating the xml file with XSL stylesheets or not.

I think this is the only open door left for me now.

Thanks for the help!