Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1371 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Other Programming Languages :

Need Some RewriteRule Help

Thread title: Need Some RewriteRule Help
Closed Thread    
    Thread tools Search this thread Display Modes  
09-03-2007, 09:05 AM
#1
Sutocu is offline Sutocu
Sutocu's Avatar
Status: I'm new around here
Join date: Sep 2007
Location:
Expertise:
Software:
 
Posts: 12
iTrader: 0 / 0%
 

Sutocu is on a distinguished road

  Old  Need Some RewriteRule Help

I have a URL with two question marks in it (one of the parameters is another URL). I'm sure that such URLs won't easily get indexed, so I'd like to have a rewrite rule to change it from index?url=http://www.domain.com/?p=1 to /url/http://www.domain.com/?p=1 but can't seem to find a way. Everything I've tried cuts the parameters from the URL so it becomes index?url=http://www.domain.com/ Any idea how to do it?

09-03-2007, 12:38 PM
#2
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

You need to 'url encode' the url item in the query string ("http://www.domain.com/?p=1"). Your encoded url will be
index?url=http%3A%2F%2Fwww.domain.com%2F%3Fp%3D1
That could then be rewritten easily to /url/http%3A%2F%2Fwww.domain.com%2F%3Fp%3D1 without too much trouble.

To get the encoded url string you can use JavaScript's encodeURIComponent function or PHP's urlencode function, to name a few.

09-03-2007, 05:26 PM
#3
Sutocu is offline Sutocu
Sutocu's Avatar
Status: I'm new around here
Join date: Sep 2007
Location:
Expertise:
Software:
 
Posts: 12
iTrader: 0 / 0%
 

Sutocu is on a distinguished road

  Old

Originally Posted by Salathe View Post
You need to 'url encode' the url item in the query string ("http://www.domain.com/?p=1"). Your encoded url will be
index?url=http%3A%2F%2Fwww.domain.com%2F%3Fp%3D1
That could then be rewritten easily to /url/http%3A%2F%2Fwww.domain.com%2F%3Fp%3D1 without too much trouble.

To get the encoded url string you can use JavaScript's encodeURIComponent function or PHP's urlencode function, to name a few.
Is that the only way to make it work? I don't have access to the php code that generates the URL. I could fix it with JavaScript, but that wouldn't be very search engine friendly... And since SEO was the reason for doing this, it really isn't an option. Thanks for the help, but is there any other way?

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed