We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
HTTP Status Codes in .htaccess
Topic Started: Jun 24 2005, 04:21 PM (1,755 Views)
Ben
Member Avatar
Quantum-locked when observed.

I'm wondering how one would send an HTTP status code through a .htaccess file (or if it is even possible).

I have a file located at policies.php. For the sake of using friendly URIs, I have used mod_rewrite in my .htaccess file to redirect "sitename/policy/" to policies.php. Now, however, I want to change that so mod_rewrite will redirect "sitename/fleetlaw/" to policies.php.

Now, I know that I can set that up easily without doing anything else. However, I'd like to also set it up so when a client accesses "sitename/policy/" they will be directed to policies.php and get a 301 (Moved Permanently) status code.

Is there some way to do this in .htaccess? I'm thinking putting something in:
Code:
 
<Directory /policy>
#code goes here
</Directory>


I'm just not sure what sort of code would accomplish my objective (to generate a 301 HTTP Status code).
Offline Profile Quote Post Goto Top
 
Stefan
Member Avatar
Mew?
[ *  *  *  *  *  *  * ]
Redirect permanent sitename/policy/ http://host.com/path_to/policy.php

might work, unless you mean your domain by "sitename", then it's

Redirect permanent /policy/ http://host.com/path_to/policy.php

http://httpd.apache.org/docs-2.0/mod/mod_alias.html#redirect ^_^
Offline Profile Quote Post Goto Top
 
Ben
Member Avatar
Quantum-locked when observed.

Ah-hah, that looks good. Thanks. :D
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply