houssam_ballout Posted November 17, 2009 Share Posted November 17, 2009 Hello,I need help with this issue:I had the site:sub.site.comwhen the user enter sub.site.com into their browser, a link opens: sub.site.com/page1/page1.1/......Is there some way in JavaScript or maybe php to make the URL fixed?Thanks in advance Link to comment Share on other sites More sharing options...
jeffman Posted November 17, 2009 Share Posted November 17, 2009 Google .htaccess and URL rewriting. Link to comment Share on other sites More sharing options...
houssam_ballout Posted November 17, 2009 Author Share Posted November 17, 2009 Google .htaccess and URL rewriting.well, the RewriteRule is directing the page, all what I need is just to fake the URL Link to comment Share on other sites More sharing options...
boen_robot Posted November 17, 2009 Share Posted November 17, 2009 well, the RewriteRule is directing the page, all what I need is just to fake the URLThe server is responsible for selecting a file to run. It is only after that where you can use that file to do whatever you want, including redirecting the user to another URL or acting as if you are "it".How do you see the server understanding thatsub.site.com/page1/page1.1/ is equivalent to (for example) sub.site.com/index.html without you explicitly telling it so?URL mappings MUST be done by the server. No way around it. Link to comment Share on other sites More sharing options...
Redroest Posted November 18, 2009 Share Posted November 18, 2009 There is no option in any language to change your main domain (sub.site.com) due to security reasons. However, if you mean shortening the URL from 'sub.site.com/page1/page1.1/......' to 'sub.site.com', there are multiple way's in almost any language:If you have complete control over the domain (this means in this case that you can acces a file called: sub.site.com/index.php or index.html) you can do the following in the index.html or index.php (whatever your main file is) with java script: <script type="text/javascript"><!–window.location = "http://sub.site.com/page1/page1.1/......";//–></script> above will output the page with the long link but it shows sub.site.com as urlOr do it in php: (witch is better in my opinion) <?phpinclude("page1/page1.1/......");?> A simpel, but old and in-efficiënt method is Iframe in html: <iframe src='page1/page1.1/.....' /> I hope this solved your problem?Okok, there is actually a way to fake an URL from the web but this is called hacking or abusing so it is against the law Link to comment Share on other sites More sharing options...
houssam_ballout Posted November 19, 2009 Author Share Posted November 19, 2009 There is no option in any language to change your main domain (sub.site.com) due to security reasons. However, if you mean shortening the URL from 'sub.site.com/page1/page1.1/......' to 'sub.site.com', there are multiple way's in almost any language:If you have complete control over the domain (this means in this case that you can acces a file called: sub.site.com/index.php or index.html) you can do the following in the index.html or index.php (whatever your main file is) with java script:<script type="text/javascript"><!–window.location = "http://sub.site.com/page1/page1.1/......";//–></script> above will output the page with the long link but it shows sub.site.com as urlOr do it in php: (witch is better in my opinion) <?phpinclude("page1/page1.1/......");?> A simpel, but old and in-efficiënt method is Iframe in html: <iframe src='page1/page1.1/.....' /> I hope this solved your problem?Okok, there is actually a way to fake an URL from the web but this is called hacking or abusing so it is against the law how can I implement this? Link to comment Share on other sites More sharing options...
ShadowMage Posted November 20, 2009 Share Posted November 20, 2009 how can I implement this?Not sure about the javascript one, I assume you would just put it in the <head> tags of your page.For the php you could do it like this:<body><?phpinclude("page1/page1.1/......");?></body> Link to comment Share on other sites More sharing options...
Redroest Posted November 21, 2009 Share Posted November 21, 2009 The php, javascript and html versions all go between <body></body>I only use javascript functions, meta tags and CSS between the <head></head> tags. Link to comment Share on other sites More sharing options...
ShadowMage Posted November 23, 2009 Share Posted November 23, 2009 The php, javascript and html versions all go between <body></body>I only use javascript functions, meta tags and CSS between the <head></head> tags.Ah yes you're right. Functions go in the head other stuff in the body. I usually try to stick to that rule, too. Link to comment Share on other sites More sharing options...
Synook Posted November 23, 2009 Share Posted November 23, 2009 JavaScript doesn't necessarily have to go in the head; in fact Yahoo's Best Practices for Speeding Up Your Web Site[1] suggest placing the scripts at the bottom of pages. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.