Zerpex Posted March 12, 2012 Share Posted March 12, 2012 Hello everyone, I can't connect to IRC at the moment :/ Anyways, I'm creating a site, where I use 'pretty' urls, I'm rewriting etc contact.php to contact/ At the moment I'm on localhost/website/ and everything is working great! but as soon as I go to localhost/website/contact/ all the styles, and images, and JS is missing :/ This is how my RewriteEngine is at the moment: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ $1.php [L,QSA] Quote Link to comment https://forums.phpfreaks.com/topic/258729-mod_rewrite-style-missing-when-in-sub-folder/ Share on other sites More sharing options...
requinix Posted March 12, 2012 Share Posted March 12, 2012 Your various img and script srcs, link and whatever else hrefs all need to be absolute. Right now they have relative URLs like Or maybe ../path. Whatever. Those are all relative paths and they're relative to the current page. Go into enough subdirectories and the paths will break. Change them to include a leading slash: That way they'll always come out of the same place regardless of the current page. Quote Link to comment https://forums.phpfreaks.com/topic/258729-mod_rewrite-style-missing-when-in-sub-folder/#findComment-1326363 Share on other sites More sharing options...
Zerpex Posted March 12, 2012 Author Share Posted March 12, 2012 Hia! I solved the problem another way actually! I used the <base> attribute in html and it worked as it should! Quote Link to comment https://forums.phpfreaks.com/topic/258729-mod_rewrite-style-missing-when-in-sub-folder/#findComment-1326378 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.