I'm trying to understand code that I bought so I can modify it.
In the index.php there are picture links:
<a href="test10,10"><img title="" border=1
src="makethumb.php?pic=product_images/test101.jpg&w=121&sq=N" / ></a>
I don't understand the href since it is not pointing to a page. test10 is an id of a picture. I assumed it was going back to the index.php and the code would extract the test10,10 from the url, but it's not. I know that because I put in trace code as the first line.
The question is, where is the link going to?
I know it that it somewhere in the process it executes a page called profile.php, but nowhere in the source code (doing a global search) is there an explicit call to profile.php.
As a related question, is there a way to profile the code to see what pages it's calling without using xdebug, which for the life of me I can't get working after many hours of trying every suggestion I found here and else where. (I'm using xampp)
The flow is: you enter the site www.site.com/final/index.php. which displays pictures with the link as above. When you click on the picture with an id of test10 it takes you to www.site.com/final/test10,1
thanks
The question is, where is the link going to?
Under normal circumstances, a request to
www.yourdomain.com/current_directory/test10,10
is made.
Usually, Apache will try to find a file of that name, and fail.
If the behaviour you get is different, then there is probably a mod_rewrite rule set up somewhere. Look for .htaccess files (note, files in parent directories affect all children) and check the httpd.conf, httpd-vhosts.conf and other log files for any RewriteRule settings.
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 :-)
This is one of those problems that make me question my sanity. I'm using php, codeigniter framework, removing index.php from URL with mod rewrite in htaccess.
I'm at this address
http://localhost/health/users/bob/progress/
I click a link that takes me to
http://localhost/health/users/bob/progress/01-04-15
Then I click on a link that takes me back to
http://localhost/health/users/bob/progress/
Now here's the strange thing. I click on the same link that earlier took me to
http://localhost/health/users/bob/progress/01-04-15
But instead, now it's taking me to
http://localhost/health/users/bob/progress/progress/01-04-15
I've gone through the steps a dozen times now. This is definitely the behavior it's giving me. It even happens when I do a full refresh. I actually have to visit a different address, then return to get the link at
http://localhost/health/users/bob/progress/
to work properly again. I'm guessing it's either related to the mod rewrite, or some other rewrite behavior in the codeigniter framework.
I'm pretty sure you are using a relative path for the link that goes something like:
link here
I would suggest that you use CI's base_url instead so that the link becomes absolute:
link here
the base_url is set on your configuration file. Please let us know how it goes!
My guess is that your link looks something like the following, and because of that it get's appended to the current url
href="progress/01-04-15"
Try making your link using absolute path, preferably appending it with base_url or current_url from codeigniter + progress/date.
href="http://localhost/health/users/bob/progress/01-04-15"
That way you will get to the correct link every time, instead of appending it to current url.
So in the included image, you can see a copy of the website I'm currently working on. The site is going to have separate pages for each of the company's machines. Obviously the navigation bar and menu bar are going to be the same throughout the whole website so I thought I'd make use of a single line of PHP script to just load the menu in each time.
http://i.imgur.com/spVS3a4.png
(Attached image as I do not have +10 rep yet)
Though, from what I understand, the pages within folders (Not within root) wont be able to link to the rest of the site without the use of ../ within the href.
So if I load the menu part of the site containing the navbar, etc, it won't work on all the pages because they'll all be within different folders, meaning every folder will need it's own version of the navbar PHP import.
Am I going about this the wrong way? I'm just trying to minimize the amount of code I'm using on each page. Not only that, but once I finish the site if I have to make a change to the menu-bar, I don't want to have to update 30-40+ pages. I figured the PHP import would save me that sort of trouble? Is there a better way of doing this that isn't terribly complicated?
It should also be noted that I'm doing this in HTML5 with Twitter-Bootstrap as my main CSS.
I would also be making a similar PHP call that would import a footer as well.
If I missed anything that could be of help, please do ask.
TL;DR - How do I make links work throughout the entirety of the site, regardless of where they are in the folder hierarchy. Thought about using a tiny PHP script that would contain the menubar, etc and would be loaded on every single page. Though I'm not sure if that will work due to folders?
Try to start your links from /. This means that url is started from site root.
For example:
Patch Kettles
Just define a constant with the root path and echo it within all the links inside the pages that are contained in a folder like this:
[Put this in a file that you include through out your whole website (e.g. like the file with your database connection if you have one)]
define('BASE_URL' , 'http://'.$_SERVER['HTTP_HOST'].'/');
Than just add an echo in the start of each link:
Home
And for images the same thing:
<img src="<?php echo BASE_URL; ?>images/img_01.jpg"/>
You can just use /path/to/image.jpg to get absolute paths, while still being fine if your domain name ever changes.
I need to locate the file that manages the main page of my online store developed with Magento (which would be the index.html). I just need to change a link, and I've used Firebug shows that the file i need to edit is "misitioweb.com" (the main page) but the document itself does not appear in the ftp. The initial page consists of a bunch of XML, and PHP's PHTML. If someone wants to see the address page is http://peluches-cel.com and only want to change the destination URL of the link "Peluche del mes". I have used the help of Magento to show "Help template route" and I downloaded the 4 files that are more likely to manage that area of the page, but I can not find the part where specify the destination URL of the link. I have always worked with HTML or PHP separately (I have little experience with PHP) and I find it very difficult to understand how Magento builds each website. If someone could give me a little hint on how to achieve change that link would you do me very happy, it took a long time trying it on my own and looking online but can not find how to do any guestbook or forum that explains how to work well with Magento, in my language, there are hardly any documentation on Magento, so I decided to try my luck in this forum and I've read on several pages that involves many professionals in the e-commerce. Thanks in advance to all who devote their time to read my question.
I don't really understand what you want.
But if you want to change the base URL, you can do that by accessing database via phpMyAdmin, find the table core_config_data and change the URL in the web/unsecure/base_url and web/secure/base_url to what you want.
Not the url of the page, but the url of a link. Try clicking on "Peluche del mes" and see what comes out, gives access to http://www.peluches-cel.com/peluche-del-mes, I want access to http://www.peluches-cel.com/oso-tiziano-2col-40cm directly. The problem is NOT EXISTS peluches-cel.com/oso-tiziano-2col-40cm page on FTP, to be done in PHP there are different functions that are responsible for creating it at the time of the request I need to change the link to "Peluche del mes", if you see with firebug or any other source code analyzer, the source code of the page you will see that line 146 is managed that link, but I can not directly access the code ¿do you understand me? through an ftp client no such file or html as php magento works with the model view controller, that's my problem. Thank you again.
I have a problem.
I ma moving a system from one server to another and I came across a peculiar problem. There are some pages placed in a subfolder like these:
xttp://test.domain.com/admin/oders.php
xttp://test.domain.com/admin/users.php
xttp://test.domain.com/admin/whatever.php
Now, when I move around the pages, via some simple menu with links I get most of the times correct hits. But from time to time I end up on say:
xttp://test.domain.com/admin/admin/oders.php - which obviously causes 404
When I go back to previous page and press the link again it again works all right. Also when I hover over the links they always show proper paths regardless of whether I am going to get 404 or not. All links are dynamically generated by the scripts but they work perfectly on old server and as I say to a naked eye it all looks OK, right until I press the link.
Anyone has an idea where to look for a bug or which tool to use to see what is happening when I press the link? URL mod rewrite? Domain configuration? I am at a loss.
It sounds like the scripts are getting confused between
[xttp://test.domain.com]/admin/file.php
admin/file.php
file.php
Without seeing how the URLs are generated it's impossible to say how this is happening.