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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Installing SilverStripe /

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

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

how to hide my stylesheet from Page Source?


Go to End


2 Posts   4730 Views

Avatar
Mikan

Community Member, 17 Posts

17 January 2010 at 10:19pm

Edited: 17/01/2010 10:23pm

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

Forum Moderator, 5523 Posts

18 January 2010 at 9:27am

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]