Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe

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

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

how to hide my stylesheet from Page Source?


Reply

2 Posts   3154 Views

Avatar
Mikan

17 January 2010 at 10:19pm (Last edited: 17 January 2010 10:23pm), Community Member, 17 Posts

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

Avatar
Willr

18 January 2010 at 9:27am Forum Moderator, 5511 Posts

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]