- 0
[php] Remove slash from beginning of REQUEST_URI generated link
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Similar Content
-
- 3 answers
- 3,235 views
-
QNAP issues patch for an RCE security vulnerability affecting PHP in NAS Drive management
By Alap Naik Desai,
- remote code execution
- rce
- (and 12 more)
- 0 replies
- 6 views
-
Get this Dynamic 2022 Data & IT Security Training Bundle at 97% off
By News Staff,
- neowin deals
- cyber security
- (and 4 more)
- 0 replies
- 6 views
-
Save 98% off this 27 Course Premium Learn to Code Certification Bundle
By News Staff,
- neowin deals
- coding
- (and 10 more)
- 0 replies
- 9 views
-
Get the Complete 2021 Superstar Backend Developer Bundle for only $39.99
By News Staff,
- neowin deals
- sponsored
- (and 7 more)
- 0 replies
- 321 views
-
Question
Syanide
This is ruining my day and I'd appreciate some help.
I'm working on a simple portfolio website. The only php I use is to get the current URL in order to avoid using the regular social share buttons.
In case you don't know what I'm talking about, instead of adding the javascript buttons on the page, you can use simple links to share things on Facebook, Twitter etc. I'll use Google+ as an example, just for lolz.
To share a page on it, this is what you need:
I used the REQUEST_URI function to get the current page url, in order to save time and not repeat the process manually for each individual page. The problem is I use datacontent-url to display the pages on top of index.html, and REQUEST_URI has no way of knowing that, so I had to tweak it a bit.
This would be the default code:
This would output http://example.com/examplepage.html as the url for sharing, which I don't want. What I need is http://example.com/index.html#examplepage.html
So i tried this:
The problem is that REQUEST_URI adds a slash at the beginning of its part, so I end up with a broken link:
Is there way to remove the slash from the beginning of the url which is the result of the REQUEST_URI function?
Sorry if it's a dumb question, and I guess I can always update each individual portfolio page with custom, proper links, but I just figured this would save a lot of time. I tried examples from this page, but it doesn't work.
Thanks in advance.
Link to comment
Share on other sites
6 answers to this question
Recommended Posts