Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Setup file extension change in HTACCESS

Posted on 2014-03-13
7
Medium Priority
?
379 Views
Last Modified: 2014-03-13
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
Comment
Question by:mcluff
  • 4
  • 3
7 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39926045
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
 

Author Comment

by:mcluff
ID: 39926094
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
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 39926156
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:mcluff
ID: 39926177
Many Thanks Ray...

Just to confirm would this do css...?

AddType application/x-httpd-php5 .css .php
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39926227
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
 

Author Closing Comment

by:mcluff
ID: 39926240
Great help!
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39926255
Thanks for the points and thanks for using EE, ~Ray
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question