|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Apache - .htaccess to read one file (html to php)
Hello everyone...
I have searched the entire web and found you guys and I am hoping you can help me. I am a newbie to .htaccess but always willing to learn. We have one page on our site that is a .html file that needs to be read as php. The file name is mywebsite.com/cmd.html. When I rename the page to cmd.php it works perfectly. The file HAS to stay as a cmd.html file name. Here is what I have done so far: - I have saved the .php file as a .html file. - Created the following .htaccess file <FilesMatch "^/cmd\.html$"> SetHandler php-script </FilesMatch> Then when I visit my webpage mywebsite.com/cmd.html it gives me one line of coding that displays as html and nothing else. Do you have any idea how I can fix this problem? Thanks, Tyler |
|
#2
|
|||
|
|||
|
tried this yet?
Code:
<Files cmd.html> AddType application/x-httpd-php .htm .html </Files> or even just rename it to cmd.php and use url rewrite: Code:
RewriteRule ^cmd\.html$ cmd.php [L] |
|
#3
|
|||
|
|||
|
It worked with the following...
Code:
<Files cmd.html> ForceType application/x-httpd-php </Files> Now I need to add to the .htaccess file. I need to redirect our subdomain blog.mydomain.com to mydomain.com/blog. I can figure out how to redirect a page on the site using .htaccess but not a subdomain. Any help? Tyler |
|
#4
|
|||
|
|||
|
Pleeeease help me with this "pretty please"
Hi all,
Well I have KINDA the same problem but with NOT being able to read a directory. I have a site with this as my .htaccess #php_value error_reporting 0 #DirectoryIndex main.php RewriteEngine On RewriteRule video/([^/]+)?$ index\.php?video=$1 [L] RewriteRule tag/([^/]+)?$ index\.php?tag=$1 [L] RewriteRule tag/([^/]+)/([^/]+)?$ index\.php?tag=$1&page=$2 [L] RewriteRule tag/([^/]+)/([^/]+)/([^/]+)?$ index\.php?tag=$1&page=$2&sort=$3 [L] AddType application/x-httpd-php5 .php .htm .html Now the problem is whenever I go to MYSITE/articles I get 404 each time, unless I change all the pages to .php, in this case over 200. Is there anyway around this or do I need to change all the pages to php Hope someone can help, it's driving me nuts lol. thanks for any help in advance simon |
|
#5
|
||||
|
||||
|
Quote:
What page are you trying to load when you type in a directory name? I'm assuming index.php? In this case, uncomment the line you have and change it like this...
__________________
Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Server Administration > Apache - .htaccess to read one file (html to php) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|