1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to get permelink as orginal url?

Discussion in 'PHP' started by haliloo22, Oct 26, 2016.

  1. #1
    i have a url shortner plugin for wordpress

    i can add links like:

    www. google. com/file.get-2323
    www. bing. com/hello-oo

    it gets me then short urls as next:

    http:// domain. com/f6b5e21d54
    http:// domain. com/a610d31cde

    but i want full permelink as the orginal urls. so i want the short urls as:

    http:// domain. com/f6b5e21d54/file.get-2323
    http:// domain. com/a610d31cde//hello-oo

    i have the php file here under, can somebody please tell me what i need to change to get this result?

    here is the php code: http://pastebin.com/RVf4HPSz
     
    haliloo22, Oct 26, 2016 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,487
    Likes Received:
    4,455
    Best Answers:
    123
    Trophy Points:
    665
    #2
    You are getting "slugs" mixed up with "permalinks" but I get what you are trying to do (puzzled about the why, but I get the what).

    What isn't working in your script?
     
    sarahk, Oct 26, 2016 IP
  3. Einheijar

    Einheijar Well-Known Member

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    3
    Trophy Points:
    165
    #3
    Your probably want to issue a curl request.
    
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);
    echo curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
    
    PHP:
     
    Einheijar, Oct 26, 2016 IP
  4. haliloo22

    haliloo22 Member

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #4
    hello where do i need to add that?
     
    haliloo22, Oct 27, 2016 IP
  5. Einheijar

    Einheijar Well-Known Member

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    3
    Trophy Points:
    165
    #5
    Einheijar, Oct 27, 2016 IP
  6. haliloo22

    haliloo22 Member

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #6
    Last edited by a moderator: Oct 27, 2016
    haliloo22, Oct 27, 2016 IP
  7. sarahk

    sarahk iTamer Staff

    Messages:
    28,487
    Likes Received:
    4,455
    Best Answers:
    123
    Trophy Points:
    665
    #7
    No, you don't need to use .htacess
    You do need to tell us what your script isn't doing so far.
     
    sarahk, Oct 27, 2016 IP
  8. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #8
    As I understand it, he has an url-disguiser/url-shortener that hides the original url - how it works is anybody's guess. He wants to change the shortened url to something almost the same as the originally shortened url, but add the actual end object for the link at the end of the shortened url. Why, I have no idea. However, this all depends on how the url-shortener is coded, and since he doesn't tell us which one he uses, or give us the code for it, we can't help him. However, I doubt it will be a simple rewrite, since that url-rewriter has to store the connection between the shortened url and the original url somewhere, probably in the database, and changing the output will probably break it.
     
    PoPSiCLe, Oct 27, 2016 IP
  9. sarahk

    sarahk iTamer Staff

    Messages:
    28,487
    Likes Received:
    4,455
    Best Answers:
    123
    Trophy Points:
    665
    #9
    He does though, it's in the pastebin - I just can't be arsed setting up a test environment to work out what it's doing now, what errors he's getting etc
     
    sarahk, Oct 27, 2016 IP
  10. haliloo22

    haliloo22 Member

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #10
    but i gived the code?

    here is the php code: http://pastebin.com/RVf4HPSz
     
    haliloo22, Oct 27, 2016 IP
  11. sarahk

    sarahk iTamer Staff

    Messages:
    28,487
    Likes Received:
    4,455
    Best Answers:
    123
    Trophy Points:
    665
    #11
    what is that code doing?
    is it giving errors?
     
    sarahk, Oct 27, 2016 IP
  12. haliloo22

    haliloo22 Member

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #12
    cant u read my question? what i want?
     
    haliloo22, Oct 27, 2016 IP
  13. Einheijar

    Einheijar Well-Known Member

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    3
    Trophy Points:
    165
    #13
    He's not getting any errors, the code produces a post with a shorcode. What he wants to do is append a directory path to the end of the shortcode . So instead of of /asdasd123/ , he wants
    /asdasd123/something

    Easiest way I can think of is a simple rewrite rule within wordpress.
     
    Einheijar, Oct 27, 2016 IP
  14. sarahk

    sarahk iTamer Staff

    Messages:
    28,487
    Likes Received:
    4,455
    Best Answers:
    123
    Trophy Points:
    665
    #14
    I can, but you give us code and you don't tell us where the code falls short. I'm assuming it's not actually your code but it would help if you could tell us what you've tried, etc. It looks pretty straight forward but you have to help us help you.

    This might help
    http://sandbox.onlinephpfunctions.com/code/48eed6da063f15618d926eebc3c8f2254da1c090

    and then you just need to update your wordpress plugin
     
    Last edited: Oct 27, 2016
    sarahk, Oct 27, 2016 IP
  15. haliloo22

    haliloo22 Member

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #15
    can you please help with this? how?
     
    haliloo22, Oct 27, 2016 IP
  16. sarahk

    sarahk iTamer Staff

    Messages:
    28,487
    Likes Received:
    4,455
    Best Answers:
    123
    Trophy Points:
    665
    #16
    Was my code no help then?
     
    sarahk, Oct 27, 2016 IP
  17. Einheijar

    Einheijar Well-Known Member

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    3
    Trophy Points:
    165
    #17
    Doesn't quite accomplish what he wanted, he wants the wordpress slug to look like /RANDOMSTRING/EXTRASTUFF
     
    Einheijar, Oct 27, 2016 IP
  18. sarahk

    sarahk iTamer Staff

    Messages:
    28,487
    Likes Received:
    4,455
    Best Answers:
    123
    Trophy Points:
    665
    #18
    Ummm - that's exactly what it does

    upload_2016-10-28_17-41-28.png
     
    sarahk, Oct 27, 2016 IP
  19. Einheijar

    Einheijar Well-Known Member

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    3
    Trophy Points:
    165
    #19
    Yeah the cosmetic part. Unfortunately wordpress won't recognized what comes after the slug though.
     
    Einheijar, Oct 27, 2016 IP
  20. sarahk

    sarahk iTamer Staff

    Messages:
    28,487
    Likes Received:
    4,455
    Best Answers:
    123
    Trophy Points:
    665
    #20
    The OP didn't say anything about the links being recognised by wordpress - I figured he would be passing them through some affiliate link system
    I'm guessing though. This whole thread is a mystery.
     
    sarahk, Oct 27, 2016 IP