Re: .htaccess - change index.php to index.abc
| From: | Jochem Maas | Date: | Tue, 06 Jun 2006 20:38:59 +0000 |
| Subject: | Re: .htaccess - change index.php to index.abc | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237507@lists.php.net to get a copy of this message | ||
Joe Wollard wrote:
> If you don't want to change the names of the files themselve from .php to
> .abc then you'd need to use something like mod_rewrite for apache's HTTPD.
> I'm not entirely certain as to how you'd do this, but I've included what I
> normally use to hide index.php in the url. If possible I'd put this in
> httpd.conf instead of .htaccess - there are performance concerns that
> may be
> involved there. Anyway, I hope this gets you started or sparks an idea from
> another list member.
>
> <Directory /var/www/html/>
> RewriteEngine on
> RewriteBase /
>
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
off the top of my head, the following rule would
translate 'afilenamestub.foo' (where 'foo' can be any extension,
and 'afilenamestub' can contain dots) to 'afilenamestub.php':
RewriteRule ^(.*)\.[^.]*$ $1.php [L,QSA]
combined with the RewriteConds given above (to only rewrite
when a file doesn't exist and/or isn't a dir)
no warranty is available - I happily lose days trying to get RewriteRules
running and tuned :-P chances are it requires tweaking to get working.
> RewriteRule ^(.*)$ index.php/$1 [L,QSA]
> </Directory>
..