ykarmi Posted December 30, 2007 Share Posted December 30, 2007 Hey guys, I have done an htaccess redirect like this: RewriteEngine on RewriteRule ^projects/([0-9a-zA-Z-]+)\.html$ /display_project.php?project=$1 So that any alphanumeric html page in the folder projects would redirect to display_project.php Works perfectly. Now my only problem is that the file display_project.php is really located in the root of the site (not the folder projects) and it required a lot of files located in the root as well. The problem with that is, that when the file calls, say, style.css it calls it from the folder projects though it is really located in the root. As a result the file is not found, and is not used. Is there any way I can force display_project.php to get all the files it requires from the root rather than the folder it (thinks it) is in? If not, what's another solution? Thanks a lot, ykarmi Quote Link to comment https://forums.phpfreaks.com/topic/83690-solved-htaccess-redirect/ Share on other sites More sharing options...
raku Posted December 30, 2007 Share Posted December 30, 2007 I think your problem is that you aren't using absolute URLs. For example, for your style includes, you would use "/style.css" instead of just "style.css" if it is located in the site root. Hope this helps! Quote Link to comment https://forums.phpfreaks.com/topic/83690-solved-htaccess-redirect/#findComment-425857 Share on other sites More sharing options...
raku Posted December 30, 2007 Share Posted December 30, 2007 Also, your rewrite rule isn't really redirecting the user. If you want a complete redirect, add [R=301] to the end of that rewrite directive. Quote Link to comment https://forums.phpfreaks.com/topic/83690-solved-htaccess-redirect/#findComment-425858 Share on other sites More sharing options...
tibberous Posted December 30, 2007 Share Posted December 30, 2007 I had the same problem on my site: http://www.flashgamereviews.com/ The solution: <base href="http://www.your-url.com/"> There is a bug in FF where background doesn't use it right, but background-image: url doesn't have that problem. Quote Link to comment https://forums.phpfreaks.com/topic/83690-solved-htaccess-redirect/#findComment-425874 Share on other sites More sharing options...
ykarmi Posted December 30, 2007 Author Share Posted December 30, 2007 Thanks a lot guys! Problem solved. Just a little slash and POOF - it works. Quote Link to comment https://forums.phpfreaks.com/topic/83690-solved-htaccess-redirect/#findComment-425999 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.