PDA

View Full Version : htaccess rewrite does't work


Calahan
08-01-2013, 01:00 PM
Hello
I am using an older plugin which rewrites a php file to a html

The htaccess which did this on my old server is

AcceptPathInfo On
<Files topic>
ForceType application/x-httpd-php
</Files>
<Files forum>
ForceType application/x-httpd-php
</Files>

Unfortunately it doesn't work on my new server.
If I click on the link the browser tries to download the php file

final kaoss
08-01-2013, 01:14 PM
try this.

AddType application/x-httpd-php htm html php
AddHandler application/x-httpd-php .htm .html

Calahan
08-01-2013, 01:28 PM
I added it to the htaccess
If I access the files now it directly starts a download of the files

Do I have to change something in my httpd.conf or php.ini?

final kaoss
08-01-2013, 01:34 PM
If that doesn't work, this is said to be working. Let me know if it does the job for you or not.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^site.com [NC]
RewriteRule ^(.*)$ http://www.site.com/$1 [L,R=301]

RewriteCond %{REQUEST_URI} ^(.*)\.php$
RewriteRule ^(.*) /$1.html [R=301,L]

Calahan
08-01-2013, 03:32 PM
Thank you for your help but I doesn't work
If I write this in the htaccess file and enter my URL it shows me the PHP-code of the file

final kaoss
08-01-2013, 03:42 PM
Alright then I suggest you continue your search here, maybe you can find something that works. GL!

https://www.google.com/search?q=rewrite+.php+to+.html&oq=rewrite+&aqs=chrome.1.69i57j69i59j69i61j0j5j69i61.5205j0&sourceid=chrome&ie=UTF-8