user4fun Posted September 24, 2007 Share Posted September 24, 2007 this is the format for a link<a href="http://www.mydomain.com/contact.php">the resultswww.mydomain.com/contact.phpBUTsometimes it ends up beingwww.mydomain.com/contact.php/which on submit it gets screwed and becomeswww.mydomain.com/contact.php/feedback_send.phpinstead of www.mydomain.com/feeback_send.phphow can i fix that?or why does it automatically adds the "/" when the original link is clicked. Link to comment Share on other sites More sharing options...
denny911 Posted September 24, 2007 Share Posted September 24, 2007 this is the format for a link<a href="http://www.mydomain.com/contact.php">the resultswww.mydomain.com/contact.phpBUTsometimes it ends up beingwww.mydomain.com/contact.php/which on submit it gets screwed and becomeswww.mydomain.com/contact.php/feedback_send.phpinstead of www.mydomain.com/feeback_send.phphow can i fix that?or why does it automatically adds the "/" when the original link is clicked.try putting "/feedback_send.php" in the form's target<form name="" method="" target="/feedback_send.php"> // of coure, keep your values for name and method properties Link to comment Share on other sites More sharing options...
justsomeguy Posted September 24, 2007 Share Posted September 24, 2007 The only reason it would add a slash onto the end of a URL is if the original URL could not be found. Some browsers will add a slash to the end and ask again if the second one exists. That's because it is technically not valid to refer to a directory without a slash. If you have a directory called contact and you link to it like this:<a href="http://www.domain.com/contact">Technically you are asking for a file called contact, not a directory. The browser will ask for the file called contact, the server will return a 404, and the browser will ask for the directory called contact like this:<a href="http://www.domain.com/contact/">With the slash on the end the server identifies it as a directory and looks like up the index document for that directory. So leaving off the slash on your links would cause your users to send 2 requests to the server instead of one, it makes it a little slower.But the browser won't just automatically add slashes onto URLs that exist, there is either a rewrite rule doing that or the links are being written incorrectly. Link to comment Share on other sites More sharing options...
user4fun Posted September 24, 2007 Author Share Posted September 24, 2007 I dont think it is that kind off fix, it only happens the first timei enter the index pagei go to indexi include the file main_hdr.php which hold the linkthe cotnact page is opened with a / at the endi click the same link again and the the page is refreshed and the / is gone??? Link to comment Share on other sites More sharing options...
user4fun Posted September 24, 2007 Author Share Posted September 24, 2007 I dont think it is that kind off fix, it only happens the first timei enter the index pagei go to indexi include the file main_hdr.php which hold the linkthe cotnact page is opened with a / at the endi click the same link again and the the page is refreshed and the / is gone??? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 24, 2007 Share Posted September 24, 2007 Do you have an example online? Link to comment Share on other sites More sharing options...
user4fun Posted September 25, 2007 Author Share Posted September 25, 2007 well..... the error is in my include fileIf you click on contact on the top right, you will see that the new address will have a back slash, once you go to the page and try to click the same link again, the back slash will be gone. It is really freaky. It is even weired if you try to submit the contact page.http://www.i-s-a-f-e.com Link to comment Share on other sites More sharing options...
justsomeguy Posted September 25, 2007 Share Posted September 25, 2007 Well, this is the tag on the page:<a href="http://www.i-s-a-f-e.com/contact.php/">So the tag is being written with that slash. I don't know if you have that hard-coded or if PHP is creating it, but the link itself has the slash in it. Link to comment Share on other sites More sharing options...
user4fun Posted September 26, 2007 Author Share Posted September 26, 2007 oops, i forgot that my index page does not have the header included, but rather has its own. That is why the first time arround in the index page is has the / but once it goes to the contact pageit used the header file that has teh link without the /Thank you very much Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.