-1

Summary
I have 2 servers, 1 Production & 1 Development

Problem
I want to keep the servers URLS the same in the code. The production server will be blah.com but I want the development server to be dev.blah.com. The hard coded urls on both the sites are blah.com.

So when accessing dev.blah.com how would I be able to use Apache to keep me on this site without redirecting to blah.com? Am I looking at this correctly or is there something else I should be doing?

1
  • 1
    You should not hard code server names in code. Ever. Use relative URLs or make the base URL a configuration variable. Feb 6, 2014 at 9:34

1 Answer 1

2

If your site sends out URLs from blah.com and you click on your browser on those URLs, your browser will send you to blah.com and there's nothing you can rewrite to avoid that.

The solution for this issue is to make the base URL configurable for your site or just use relative paths in the URLs (i.e use /section/ instead of http://blah.com/section/.

1
  • You can technically have the site in blah.com check the referrer and redirect to dev.blah.com if you came from there, but that will probably break a lot of things if you site isn't strictly static.
    – GomoX
    Jan 10, 2014 at 16:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .