Re: .htaccess - change index.php to index.abc

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

 



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>

..

-- 
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