• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URI routing regexp

Hi there.
Well I've been enjoying CI for a few years now but I still havent got the hang of using regexp in my URI routing in routes.php
I was hoping for a bit of help if possible.

I am trying to route all requests for URI's that contain another URL.
For example:


the $_SERVER['REQUEST_URI'] would be like:

I was using:
but this doesn't catch the 3rd example

I'm wondering if I should either use one of those very long regexp's that look for a valid url and allow for the proceeding forward slash.

Another idea was to look for a period ('.'), But I didnt want http://mysite.com/file.txt to match.

If anyone could help with this expression I really would be very grateful. I could even send a few dollars. I've been trying to fix this for days (and nights)


I posted a couple of links for you on your stack overflow question that 'might' help (although probably not TBH). May I ask why you are trying to deal with such horrible urls? Could you not format the urls to be a bit more useable in some way or are you not in control of them. (Like http://mysite.com/url/google.com)

Hi there.
Thanks for your reply and the links you posted on stack overflow.
Yes, it does seem pretty horrible.
The uri http://mysite.com/www.another site.com is entered by a user into the browser address bar so i cant really change that.
my challenge is how to recognize that a user is adding another url onto the end of my url, regardless of whether they include the http, www, etc.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.