Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Setup file extension change in HTACCESS

Posted on 2014-03-13
7
Medium Priority
?
377 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

722 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