wordpress - Rewrite file url to different file using htaccess? -


i trying hide stylesheet when user visits directly browser, show 404, show correctly on site. possible? trying with:

rewriteengine on options +followsymlinks rewriterule ^/?wp-content/themes/mysteam/style.css$ /wp-content/themes/steam/stylesheet.css [l,nc] 

is there way can achieve this?

thanks.

you cannot securely hide css file client if want use on @ least 1 page.

you can use referer header redirect 404-page if not set, but:

  • this header can spoofed
  • in cases set anyways
  • using developer tools, still visible when viewing request there

you set smart system generate unique id every request, , show css file if id matches id authorized see page, but:

  • using developer tools, still visible when viewing request there

your stylesheet requested browser apply style text, , therefore possible forge request browser see contents of file (or output file generates) or, more simple, viewing output when browser needs it.


the syntax using invalid. see the documentation more information. pattern cannot start / , not include query string. rewriterule like:

rewritecond %{query_string} ^wp-content/themes/mysteam/style\.css$ rewriterule ^$ /wp-content/themes/steam/stylesheet.css? [l,nc] 

the first line match query string. second line has trailing ? in rewritten part clear original query string.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -