Jump to:

4938 Posts in 16602 Topics by 1490 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » how to hide my stylesheet from Page Source?

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 3117 Views
  • Mikan
    Avatar
    Community Member
    17 Posts

    how to hide my stylesheet from Page Source? Link to this post

    Hello,

    How to hide my stylesheet ?
    How to change stylesheet address or path ?
    I won't let people view it by "View -- Page Source" display as below:

    <link rel="stylesheet" type="text/css" href="http://mysite.com/themes/themesname/css/layout.css?m=123" />
    <link rel="stylesheet" type="text/css" href="http://mysite.com.com/themesname/balloonr/css/typography.css?m=123" />
    <link rel="stylesheet" type="text/css" href="http://mysite.com.com/themesname/balloonr/css/form.css?m=123" />
    </head>
    <body class="typography">
    <div id="header">

    I won't display "themes/themesname/" in public . Just hide .

    Like below:

    <link rel="stylesheet" type="text/css" href="http://mysite.com/css/layout.css?m=123" />
    <link rel="stylesheet" type="text/css" href="http://mysite.com.com/css/typography.css?m=123" />
    <link rel="stylesheet" type="text/css" href="http://mysite.com.com/css/form.css?m=123" />

    OR

    <link rel="stylesheet" type="text/css" href="../css/layout.css?m=123" />
    <link rel="stylesheet" type="text/css" href="../css/typography.css?m=123" />
    <link rel="stylesheet" type="text/css" href="../css/form.css?m=123" />

    OR

    <link rel="stylesheet" type="text/css" href="../../css/layout.css?m=123" />
    <link rel="stylesheet" type="text/css" href="./../css/typography.css?m=123" />
    <link rel="stylesheet" type="text/css" href="../../css/form.css?m=123" />

    OR

    <link rel="stylesheet" type="text/css" href="../../../ayout.css?m=123" />
    <link rel="stylesheet" type="text/css" href="../../../typography.css?m=123" />
    <link rel="stylesheet" type="text/css" href="../../../form.css?m=123" />

    OR

    <link href="css/layout.css" rel="stylesheet" type="text/css" />
    <link href="css/typography.css" rel="stylesheet" type="text/css" />
    <link href="css/form.css" rel="stylesheet" type="text/css" />

    again, I want to hide" http://mysite.com/themes/themesname/" Or "themes/themesname/" in Page Source.

    Please help me how to hide or How to change stylesheet address or path.

    Thanks

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: how to hide my stylesheet from Page Source? Link to this post

    Well because ss templates use the base tag to set the base URL you have to do those paths (relative paths won't work). You could however make a .htaccess RewriteRule to rewrite /css/ links to the actual path so you would have urls like mysite.com/css/layout.css (you will have to hardcode the stylesheet paths since requirements won't work)

    I'm not an expert at all on rewrite rules but something like this might work

    RewriteRule ^css/ themes/yourtheme/css/%1.css [L]

    3117 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.