0

enter image description here

I had a php page in which CSS/js work normally. Then I add htaccess rule like:

RewriteRule ^command_players/([0-9]+)/?$ site/command_players.php?id=$1 [NC,L]

after which page can not load CSS/js and "not found" error appear. I did not change the folder for css/js, simply add rule. When I open dev tools in browser, it seems like my page is parent folder and css/js files are child files, which is not normal. I am new in php and very confused in this folder stuff. Any suggestions are highly appreciated.

YakovL
  • 7,557
  • 12
  • 62
  • 102
Leyla
  • 29
  • 5
  • Please insert relevant bits of code (html/php linking js/css) and text of errors instead of the picture. Your problem seems to have nothing to do with php but rather with .htaccess, so I've removed the `php` tag. Best regards – YakovL Sep 04 '18 at 21:18

1 Answers1

0

You can solve this problem using one of the following ways:

Use absolute path in your css, js, images files rather than a relative one. Which means you have to make sure path of these files start either with http:// or a slash /.

Otherwise You can add this just below section of your page's HTML:

<base href="/" />

so that every relative URL is resolved from that base URL and not from the current page's URL.

CSS not loading after redirect with htaccess rewrite rule

unixmiah
  • 3,081
  • 1
  • 12
  • 26