These forums are now archived.


Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Fri Sep 25, 2009 10:10 am 
Offline
Community Liason

Joined: Thu May 05, 2005 10:22 am
Posts: 213
Location: Nottingham
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

_________________
http://theunusualsuspect.com/


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Sep 25, 2009 11:08 am 
Offline
NetHosted Staff
User avatar

Joined: Fri Jun 24, 2005 1:50 pm
Posts: 1287


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Sep 25, 2009 12:11 pm 
Offline
Community Liason

Joined: Thu May 05, 2005 10:22 am
Posts: 213
Location: Nottingham
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

_________________
http://theunusualsuspect.com/


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Sep 25, 2009 12:53 pm 
Offline
NetHosted Staff
User avatar

Joined: Fri Jun 24, 2005 1:50 pm
Posts: 1287


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Sep 25, 2009 2:37 pm 
Offline
Community Liason

Joined: Thu May 05, 2005 10:22 am
Posts: 213
Location: Nottingham

_________________
http://theunusualsuspect.com/


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Sep 25, 2009 2:44 pm 
Offline
NetHosted Staff
User avatar

Joined: Mon Mar 22, 2004 4:36 pm
Posts: 7373

_________________
| Andrew Bassett
| Managing Director, NetHosted Ltd.
| Earn £30 every time you refer someone to us!
| Follow us on Twitter:
| Members, tell us what of NetHosted!


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 25, 2009 2:57 pm 
Offline
NetHosted Customer
User avatar

Joined: Wed Jan 26, 2005 6:39 pm
Posts: 596
Location: Midlands

_________________
Paul M


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Sep 25, 2009 3:10 pm 
Offline
Community Liason

Joined: Thu May 05, 2005 10:22 am
Posts: 213
Location: Nottingham

_________________
http://theunusualsuspect.com/


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Sep 25, 2009 4:18 pm 
Offline
NetHosted Staff
User avatar

Joined: Mon Mar 22, 2004 4:36 pm
Posts: 7373

_________________
| Andrew Bassett
| Managing Director, NetHosted Ltd.
| Earn £30 every time you refer someone to us!
| Follow us on Twitter:
| Members, tell us what of NetHosted!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Sep 25, 2009 4:44 pm 
Offline
Community Liason

Joined: Thu May 05, 2005 10:22 am
Posts: 213
Location: Nottingham

_________________
http://theunusualsuspect.com/


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Oct 01, 2009 4:25 pm 
Offline
Community Liason

Joined: Thu May 05, 2005 10:22 am
Posts: 213
Location: Nottingham
I have this set up now and it's working great. Thanks for your help guys.

Richard

_________________
http://theunusualsuspect.com/


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Oct 01, 2009 4:26 pm 
Offline
NetHosted Staff
User avatar

Joined: Mon Mar 22, 2004 4:36 pm
Posts: 7373
No problem! :)

Andrew

_________________
| Andrew Bassett
| Managing Director, NetHosted Ltd.
| Earn £30 every time you refer someone to us!
| Follow us on Twitter:
| Members, tell us what of NetHosted!


Top
 Profile  
Reply with quote  
 Post subject: More mod_rewrite Stuff
PostPosted: Fri Oct 02, 2009 11:42 am 
Offline
Community Liason

Joined: Thu May 05, 2005 10:22 am
Posts: 213
Location: Nottingham
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

_________________
http://theunusualsuspect.com/


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Oct 02, 2009 1:20 pm 
Offline
NetHosted Staff
User avatar

Joined: Mon Mar 22, 2004 4:36 pm
Posts: 7373
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

_________________
| Andrew Bassett
| Managing Director, NetHosted Ltd.
| Earn £30 every time you refer someone to us!
| Follow us on Twitter:
| Members, tell us what of NetHosted!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Oct 02, 2009 2:08 pm 
Offline
Community Liason

Joined: Thu May 05, 2005 10:22 am
Posts: 213
Location: Nottingham
Okay, that sounds interesting... However, it sounds like the directories would be required (correct me if I'm wrong :p ) which is one thing I'm trying to avoid.

_________________
http://theunusualsuspect.com/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: