. Htaccess kullanarak dosya uzantısı değiştirme

3 Cevap php

Ubuntu üzerinde çalışan Iam. (Linux)

I want to display all .php pages to .html in the browser, using .htaccess. Where all php files are in the folder 'test'

örneğin one.php gibi ve de tüm diğer dosyalar one.html edilmelidir

3 Cevap

Sen sunucusu tarafından X.php olarak servis edilebilir bir X.html sayfasında yapılan tüm istekleri demek ...

Bu demek o zaman X.php istekleri gibi X.html için herhangi bir istekleri sunmak için apache yönlendirir. Htaccess dosyasında bir ReWrite Kuralı yazmak zorunda.

Ayrıntılar için aşağıdaki adresler kontrol edebilirsiniz

http://www.modrewrite.com/

http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html

Ayrıca deneyebilirsiniz

RewriteEngine On
RewriteBase /
RewriteRule ^(.+)\.html$ $1\.php [L]

I'm not very sure about what you are trying to do, but i guess that you are trying to redirect /test/foo.html to /test/foo.php you could try it with

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule ^(.+).html$ $1.php [QSA]
</IfModule>

yardımcı olur umarım

. Siz dosyaları adlandırmak html ve htaccess bu kullanabilirsiniz:

AddType application/x-httpd-php .html

.. PHP dosyaları veya php gibi dosyaları tutmak ve sadece yönlendirmek için html bu kullanın:

RewriteEngine on 
RewriteRule ^(.*)\.html $1\.php