1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Changing css.php to css.js (just extension)

Discussion in 'Troubleshooting and Problems' started by Ugur Ilmaz, Aug 6, 2016.

  1. Ugur Ilmaz

    Ugur Ilmaz Member


    I want to change xenforo's css serving extension. I already did change statical ones but I couldn't figured out how to change dynamical ones which works with this code ; "<!--XenForo_Require:CSS-->"

    For example this one ;

    <link rel="stylesheet" href="css.php?css=action_filter

    had to be like this ;

    <link rel="stylesheet" href="css.js?css=action_filter

    I want to change only the extension.
  2. Chris D

    Chris D XenForo Developer Staff Member

    From the perspective of official support, I wouldn't be happy advising someone how to do this and I'd strongly recommend reconsidering it.

    To do it would require modifying PHP code, at a minimum. You would also likely need to configure your web server to handle .js files or at minimum this specific file as a PHP script.

    What is the actual reason you would want to do this? It makes very little sense.
  3. Ugur Ilmaz

    Ugur Ilmaz Member


    Thank you for answer.

    I recently bought layer 7 firewall and when they activated it css.php breaks and doesn't loads properly. I changed my firewall provider 3 time but no luck. They have all different problems with xenforo.
    They told me it doesn't loading properly because it's php. I'm guessing they have firewall rules for that.
    Then they add this code to the .htaccess ; "RewriteRule ^css.js$ css.php" and I changed statical ones to js and suprisingly they are working fine but you know there are lots of dynamical css for each page and they are still using php.
    When I changed them manually to js they are also working fine but adding to PAGE_CONTAINER every single of them seem like a bad idea and it's lots of work.

    Since this is just a RewriteRule I don't think it would cause much trouble. Either way , It seems like I don't have any options...
  4. Chris D

    Chris D XenForo Developer Staff Member

    Frankly, I've never heard of any one having to do this before. This is not a normal thing, and really the focus should be on making the firewall work with your site, rather than making your site work with the firewall.

    I still stand by this being a bad idea, but if you must change it, you would need to edit library/XenForo/Template/Public.php and change "css.php" to "css.js".

    I'm not exaggerating, though, this is a pretty odd thing to do :)
    Ugur Ilmaz likes this.
  5. Mouth

    Mouth Well-Known Member

    An application level firewall that cannot handle a php file outputting css? ..... run, far away, you'll be thankful for it.
    the focus should be on making the firewall work with your site, rather than making your site work with the firewall.

    .... it's worthy of repeating :)
  6. Ugur Ilmaz

    Ugur Ilmaz Member

    I know that but they couldn't handle it over a day and I changed 3 firewall provider they all have different problems with xenforo and all of them didn't want to change their fw rules because they say it is working fine for other costumers.

    It's working fine now , thanks to you :)

    I have other problems too because of the firewall which they are saying we will figured it out but I don't believe they could. If you guys give any idea about that too I will really appreciated it.

    My second problem is about JS.

    Whenever I click anything works with JS , I get this error ;

    "The server responded with an error. The error message is in the JavaScript console."

    And In console I get this ;

    PHP <html><body><script>document.cookie="secure=938d280c1400306a6cc4828e083dc5bf";location.href="http://www.sitename.com/forums/members/username.139061/?card=1&&_xfRequestUr…ads/topicname.276013/&_xfNoRedirect=1&_xfResponseType=json";</script></body></html>

    handleServerError @ xenforo.js?_v=f75e54fd:233

    I deactivated every add-on I installed. This error happens when I click an username or click login in navigation bar. (Everything that has "overlaytrigger" code.)

    I know this happens because firewall's GET rules , is there something I can say to them in order to help ?

    Problems are really bizarre too they only occur when someone enters directly to topics (coming from google). I mean without entering to homepage first and when this problem occurs if they turn back to homepage all of the problems go away and never happens for that visitor again.

    I know you guys will say don't use that and search for another but I really looked. In my country there isn't lots of options when it comes to layer 7 firewall.
    Last edited: Aug 7, 2016
  7. Tracy Perry

    Tracy Perry Well-Known Member

    Why are you restricted to your country when there are world-wide providers?
  8. Ugur Ilmaz

    Ugur Ilmaz Member

    Lots of people have really bad internet connection so they often experience connection issues with foreign servers also it's expensive because our money is valueless when it's compared to dolar or euro.

Share This Page