I need to set-up my htaccess file so when a user inputs http://www.example.com/post/54 it renders as http://www.example.com/post.php?id=54
I setup the rule as such:
RewriteRule ^post/(.*)$ post.php?id=$1 [L]
When I test it on my localhost, the page only displays it as html and does not capture the images nor the CSS file. My directory is setup as C:/MyWebsites/example and it appears the file is loading not in the directory but in the C:/MyWebsite folder. What would be causing this…
The browser tries to determine what the URI base is using the URI of the request. So when the browser requests
http://www.example.com/post/54, the URI is/post/54and the BASE is/post/. With this base, all relative links will have this appended to the front of the link and this makes it so relative links to things like css have the wrong base.You need to either change all your links to absolute links, or add a
to the header of your
post.phppage.