This is an awkward question but I am helping edit a site and there are some text fields in the MySQL table that I wanted to edit. One of the edits I wanted to do was add a hyperlink.
So I went ahead and put in <a href = " etc. etc." </a>. When I save it and view the website, the website injects the site's URL before my link breaking the link.
e.g. I am working www.example.com trying to insert a hyperlink to www.google.ca
It will output as www.example.com/www.google.ca instead of www.google.ca
I am pretty new to PHP/MySQL so I'm not sure if this is common or what is causing this. I tried looking at the file itself and the css to see if there was something causing this. I am not sure if this is even a normal thing or if there is a workaround it that I'm unaware of.
If anybody has ideas on where I should look (if they suspect it's the site that's injecting it), please let me know.
As I mentioned in the comments above already:
Google
is a relative url and will output as http://yoursite.tld/www.google.ca
Google
will output as a correct link.
Related
With help on my last question about removing file extensions from the address bar if the page name and file extension were keyed in directly even after using htaccess to remove them, HERE I'm now wanting to remove index from the url. Specifically, if I type in my webpage's URL into a browser like so: http://webpage.com that exact address is what I see in the browser when the page is served up. However, if I click the Home link on my page, which contains a href="index" naturally, what shows in the address bar is http://website.com/index Certainly, I could change the link in my code to a href="http://website.com" to omit the index portion from showing up in the address bar, but that seems like a hack.
I found an SO article HERE that shows a method for removing index.php but I'm a bit lost as to how, or even if the code in that answer (I get particularly stuck when seeing Rewrite Base /
) can be blended in with the code that was given to me HERE to just remove index after the file extensions have already been removed.
My apologies in advance if this isn't a clear explanation, I'm in new territory here. Many thanks in advance!
Doing proper rewriting requires you to build the correct links that you want to see being used by the web (i.e. users and search engines). Don't use URLs in your own links that point to URLs that you consider to be wrong.
The link to the home page likely should be <a href="/">, if you don't like index.
Trying to fix the problem by making the client do two requests, one for index, then receiving a redirect to /, is the hack here. Fix your links - they are under your control for a reason.
Certainly, I could change the link in my code to a href="http://website.com" to omit the index portion from showing up in the address bar, but that seems like a hack.
No, that's what I would do :-)
I currenlty have a MODx website setup, and I am wondering if it's proper to have my links look like this (And by that I mean my resource alias):
myurl.com/help/configuration/basics.html
Putting the slash in the URL like that... is it a bad practice? My main problem is that this breadcrumb plugin seems to no longer work... :(
I want to have this breadcrumb plugin operational again, if someone would mind helping me.
The Error:
When say using the breadcrumb to link to a page that's myurl.com/code/landing.html and the current page is myurl.com/help/configuration/basics.html, it will then redirect you to a link that doesnt exist, that looks like this:
myurl.com/help/configuration/code/landing.html
As you can see, it is appending the latter portion of the new page's url, but it is not properly removing the URL of the current page, as it only removes the current URL up to the '/' slash....
Does anyone know how to fix this? Possibly a way to make it so that instead of doing it's current "remove" and "append" thing, I can change breadcrumbs.class.php to take the value of the links as if I had clicked the link with the "view" button on the MODx manager? I'm not an expert at php, and it is a must for this to work.
Or are there other alternatives to creating the " / " effect in my links, rather than just putting it in the resource alias? (As I want the site to follow a logical, readable, order)
With all things modx, clear the cache, even if you don't think it could be the issue ~ modx is very aggressive about caching stuff.
Though this kinda sounds like maybe your base href tag may be set to <base href="" />, possibly in your templates it may look like:
<base href="[[++site_url]]"></base>
where site_url is set dynamically [it's not a system setting so don't look for it] in your /core/config/config.inc.php as $modx_base_url ... if that value is blank that could be causing the issue.
Also check your rewrite rules in your .htaccess to see what the rewrite base is. [it should be / ]
then refresh your cache... ;)
This post follows research and another recent SO post. That question was along the lines of "Is there a way on any PHP site to identify the file that contains the html that you are viewing on a webpage?" Using, for example "inspect element" feature.
It appears not. Fine. Is there a conventional way around this? From research it seems it's a security issue so with PHP you cannot.
I can login to the host using Filezilla. I want to edit my main Navigation menu. I'd therefore like to search for something like Nav, Navigation, Main menu etc but there does not appear to be a search feature along those lines.
What do developers typically do here (I am very new to PHP). How does one typically identify a file to make edits when they are working on a site that they did not create?
This might help: go into the source and find beginning of the specific piece of HTML generated for your navigation. It might be (I'm not including the closing tag because that might be generated dynamically):
<nav id="main"
or
<ul class="navigation"
Get something like Sublime Text and drag the project folder into it. Then do Find -> Find in Files (Ctrl-Shift-F) and search for that snippet of HTML.
Hopefully you should find what you're looking for.
i have got a price comparison website.
You can click on a link of an offer and i'll get $1 from the shop.
The problem is: crawlers crawling the whole website. So they "click on the links".
How can i prevent them from clicking? Javascript is a bad solution.
Thank you!
I've been thinking about this the wrong way.
I agree with everything that #yttriuszzerbus says above - add a robots.txt to the file, add "rel=nofollow" to links, and block the user agents that you know about.
So if you've got someone who's now trying to click on a link, it's either a live person, or a badly behaved bot that you don't want clicking.
So how about doing something strange to create the links to the shop sites? Normally, you'd never, ever do this, as it makes your site impossible to index. But that's not an issue - all the well-behaved bots won't be indexing those links because they'll be obeying the robots.txt file.
I'm thinking of something like not having an <a href= tag in there - instead, generate the text of the link adding underlining to the font using a stylesheet, so it looks like a link to a normal user, and then having a javascript onClick function that redirects the user when they click on it. Bots won't see it as a link, and users won't notice a thing.
You could:
Use "rel=nofollow" to instruct crawlers not to follow your links.
Block certain user-agent strings
Use robots.txt to exclude spread of your site.
Unfortunately, none of the above will exclude badly-behaved crawlers. The only solution to actually prevent crawlers is some kind of JavaScript link or a CAPTCHA.
I also have similar project.
My problem was solved only by block certain user-agent strings.
Another problem is that I don't know every "bad" user-agent's, so when a new crawler enters the site, I add it to the blacklist and retroactively remove its visits from statistics.
"rel=nofollow" and robots.txt not work at all for me.
I'm starting with "PrestaShop" and I just can't figure out, how to put a link in template to custom page I created in CMS module... I thought, there might be some easy way, as there is in WordPress, like "get_permalink(ID)", but there's nothing like this and I can't find anything about this anywhere and it just drives me mad.
So, here's the deal, I've got a custom template, and there are some top links, like "About Us". I've created this page in CMS and it has ID "6".
How do I make this bloody "PrestaShop" to generate a link to this page in my template file?
About
I think you're looking for SMARTY template tags and custom variables defined for Prestashop specifically. The one the you probably need is {$base_dir} which will be translated to http://www.yoursite.com/ obviously with appropriate protocol (non-secure HTTP or secured HTTPS).
After that, you only need to include page URL, which you can get from Admin->Tools->CMS section.
If I find any specific tags that you can use to call the content, I will update my post here.
Your Text
the "WHAT goes here" is just the url you want your link drives the client to when clicking on that link.
You need to understand a little minimum of HTML for this I guess. Check html tag a meaning .
Prestashop has a fairly good and extensive documentation. Two and half seconds googling drives me here, just like answering your question it looks like.