mod_rewrite q's: syntax?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all... sorry if this is OT for PHP list... Maybe a reply off-list?

I just wanted to share my .htaccess file in the hopes that I can
hone/fool-proof-a-tize it as much as possible via your feedback and
suggestions.

Here is what I got so far...

I start by turning-on error reporting, then I am converting all non www
traffic to www traffic, and I finish things up by removing "index.php" from
the site url...

[code] -->

# Turn-on PHP error messaging:
php_value display_errors 1
php_value error_reporting 2047

# Power-up the rewrite engine:
RewriteEngine on

# Redirect all non-www traffic:
RewriteCond %{HTTP_HOST} ^mydomain\.com$
RewriteRule ^.*$ http://www.mydomain.com%{REQUEST_URI} [R=permanent,L]

# Remove index.php from url:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+) index.php/$1 [L]


<-- [/code]

What I want to do:

I would like to use mod_rewrite to forward all requests for
http://www.mydomain.com (or http://mydomain.com) to
www.mydomain.com/folder/file.php

Questions:

1. How is my code looking so far? Any potential pitfalls that you can see?
2. Can I combine the conditions and rules into one, more compact, script?
3. Any suggestions on how I would go about adding-in a rule/condition to
redirect users to "....com/folder/file.php" as stated above?

Many TIA,
Sorry if OT.
Cheers,
Micky

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux