htaccess rule to redirect to a script
I'm trying to write an .htaccess rule to redirect to a script, which further redirects somewhere else. However, I don't want the address url to change during the .htaccess part of the redirect.
this page should be hanlded by test.mytest.com/environment_test.php
but test.mytest.com/page/test/hello still appears in browser.
Thanks for reply in advance
Not a thing to do with PHP. Moving to Apache configurations.
If you issue a redirect, it will follow it. Use rewrite if you don't want to make the url appear to change. Not sure how you want to formulate the matching, with the example you have here a simple:
I'm working with Rahul on this...
1) URL rewrite is what we want, thanks for clarifying.
2) Let's say we want all pages, after the domain name to be handled by environment_test.php. How would you update your htaccess for that?
Meaning, we want...
...all to be handled by environment_test.php. The application will take it from there in terms of producing an output.
3) Then, how would we throw in an exception? Say we have a file that if it is accessed in the URL, we want it to this to actually load the file they're requesting. For example...
Can we make it so anything in the /app/ folder will actually run if the file being requested (run.php) exists?
4) Lastly, we will use this for dev/staging/production - can we insert a wildcard for the domains?
any help here?
You can use RewriteCond to determine if the requested is a directory or a file. What would probably work is a:
For domains, you can also use the RewriteCond to match hosts. This would allow a one line swap when you change a domain.
I hope that helps some, I'm not an apache wizard but I can typically stumble my way through.
|All times are GMT +1. The time now is 04:02 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.