[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 381
  • Last Modified:

Setup file extension change in HTACCESS

I have a folder on my website /scripts/... and I want to change the extension of style.php to style.css...

What script do would you use in the htaccess? and is the htaccess file be in the script folder or the root?

Many thanks in advance
0
mcluff
Asked:
mcluff
  • 4
  • 3
1 Solution
 
Ray PaseurCommented:
Probably .htaccess is in the root directory.  But this is an unusual request.  PHP scripts are usually sent through the PHP parser and CSS scripts are usually not parsed.  These are normally very different file types, but in advanced applications there could be a lot of utility in parsing a CSS file.

Can you tell us a little more about the background concepts?  For example, why not just rename the files and use the conventional names?
0
 
mcluffAuthor Commented:
Hi Ray,

style.php has my dynamic css from a database in... but I want my head to display

<link type="text/css" rel="stylesheet" href="/scripts/style.css">
not
<link type="text/css" rel="stylesheet" href="/scripts/style.php">
0
 
Ray PaseurCommented:
Sure, that makes sense to me.  BTW, I do the same thing with HTML files, so I can let the HTML coders do whatever they want and I can still use PHP functionality.  Here is the line I put in .htaccess, in my web root directory:

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

You could probably use the same sort of thing.  You would want to add .css to the list of file suffixes
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
mcluffAuthor Commented:
Many Thanks Ray...

Just to confirm would this do css...?

AddType application/x-httpd-php5 .css .php
0
 
Ray PaseurCommented:
Yes, that looks right to me.  I rely on my hosting company to tell me the contents of the "application/x-httpd-XXX" part.
0
 
mcluffAuthor Commented:
Great help!
0
 
Ray PaseurCommented:
Thanks for the points and thanks for using EE, ~Ray
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now