• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

using mod_redirect and retaining full URL

 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I have Apache do something like this?

http://xyz.mydomain.com/foo1/foo2
redirected to:
http://xyz.mydomain.com/xyz/foo1/foo2

Where foo1 and foo2 are dynamic, but xyz is a constant value.

I've seen plenty of examples that redirect a domain to a new domain, or a page to a new page. But nothing that just uses a regex type switcheroo. Am I looking at using mod_rewrite? Which makes me shudder, seeing as how I'm so very good at regex.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I think this is what I'm looking for ?

But I only want this to work for the xyz.mydomain.com virtualhost and I also only want to do this if /xyz isn't already in the URL. So the rewrite would happen the first time someone hits the site, but not again, unless they remove the /xyz/ from their address bar.

Anyone with any Apache config experience want to show me the way?
[ May 26, 2003: Message edited by: Mike Curwen ]
 
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!