NetHosted Community https://www.nethosted.co.uk/community/ |
|
How can I show one URL but serve content from another? https://www.nethosted.co.uk/community/viewtopic.php?f=8&t=2724 |
Page 1 of 2 |
Author: | UserFriendly [ Fri Sep 25, 2009 10:10 am ] |
Post subject: | How can I show one URL but serve content from another? |
I would like to show http://www.example.com/ in the address bar, but display content from http://www.example.com/new/ Can I do this with mod_rewrite? Thanks. Richard |
Author: | NetHosted - Darryl [ Fri Sep 25, 2009 11:08 am ] |
Post subject: | |
Author: | UserFriendly [ Fri Sep 25, 2009 12:11 pm ] |
Post subject: | |
Thanks Darryl. I was actually just looking for a special case rule that would only affect those two urls. I don't need example.com/one.htm to show example.com/new/one.htm for example. I'm guessing that's what those rules will do (?). Thanks. Richard |
Author: | NetHosted - Darryl [ Fri Sep 25, 2009 12:53 pm ] |
Post subject: | |
Author: | UserFriendly [ Fri Sep 25, 2009 2:37 pm ] |
Post subject: | |
Author: | NetHosted - Andrew [ Fri Sep 25, 2009 2:44 pm ] |
Post subject: | |
Author: | paulmarson [ Fri Sep 25, 2009 2:57 pm ] |
Post subject: | Re: How can I show one URL but serve content from another? |
Author: | UserFriendly [ Fri Sep 25, 2009 3:10 pm ] |
Post subject: | |
Author: | NetHosted - Andrew [ Fri Sep 25, 2009 4:18 pm ] |
Post subject: | |
Author: | UserFriendly [ Fri Sep 25, 2009 4:44 pm ] |
Post subject: | |
Author: | UserFriendly [ Thu Oct 01, 2009 4:25 pm ] |
Post subject: | |
I have this set up now and it's working great. Thanks for your help guys. Richard |
Author: | NetHosted - Andrew [ Thu Oct 01, 2009 4:26 pm ] |
Post subject: | |
No problem! ![]() Andrew |
Author: | UserFriendly [ Fri Oct 02, 2009 11:42 am ] |
Post subject: | More mod_rewrite Stuff |
Hello. Me again. I have some more mod_rewrite questions related to my original request so I thought I'd just continue here. At our other site, moonremovals.co.uk I have some urls that need redirecting to new, improved urls. I'll probably do this the same way I did with our main site (southeringtons.co.uk) on a per url basis. For example: RewriteRule ^contact.htm$ http://www.southeringtons.co.uk/contact-us/ [R=301] At the same time, I would like to reorganise the actual files so I end up with each page as an individual .php file in the root directory (for example, moonremovals.co.uk/contact-us.php), but still I want people to access the pages from the new, improved urls as above (moonremovals.co.uk/contact-us/). I'll name the php files appropriately so that the same rule can be use for all of them (/contact-us.php to /contact-us/ ... /downloads.php to /downloads/ etc...). To summarise: If people visit moonremovals.co.uk/contact.htm redirect them to moonremovals.co.uk/contact-us/ and show them content from moonremovals.co.uk/contact-us.php If people visit moonremovals.co.uk/contact-us.php redirect them to moonremovals.co.uk/contact-us/ and show them content from moonremovals.co.uk/contact-us.php If people visit moonremovals.co.uk/contact-us/ don't redirect them, just show them content from mooremovals.co.uk/contact-us.php How would I go about doing this? I hope it all makes sense. Thanks. Richard |
Author: | NetHosted - Andrew [ Fri Oct 02, 2009 1:20 pm ] |
Post subject: | |
Hi, I don't really think you need mod_rewrite here. If you never advertise moonremovals.co.uk/contact-us.php anywhere on your site then no one will know it's there, you therefore always link everywhere to moonremovals.co.uk/contact-us/ and simply place the contact-us.php file in the /contact-us/ directory and add a DirectoryIndex entry to a .htaccess file in the directory so the server knows to read from the contact-us.php file. If you want to have contact-us.php in the root of your public_html to work on then you can just create a symlink to it from the /contact-us/contact-us.php file. You can then just redirects to change the contact.htm file over to the /contact-us/ directory. Thanks, Andrew |
Author: | UserFriendly [ Fri Oct 02, 2009 2:08 pm ] |
Post subject: | |
Okay, that sounds interesting... However, it sounds like the directories would be required (correct me if I'm wrong ![]() |
Page 1 of 2 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |