I have the following Short-hand for a user profile url
RewriteRule ^(\\w+)/?$ ./profile.php?name_of_user=$1
The site is styled with the app
Simply add the base path after the opening head tag. For example:
<base href="website url here">
I've had what seems to be the same problem. I was trying to redirect from a site of the form: www.foo/category/details.
I found the slash after "category" stopped both the CSS and images from being loaded.
The cause is the default redirection passes the original URL to the browser. This can be seen from a JScript trace on window.location.pathname. The solution is simply to use a [R] flag in the rewrite rule.
RewriteCond %{REQUEST_FILENAME} !-f
This works like a treat. I originally had problem even with giving absolute linking. Thanks and +1 to Steve Lewis.
link the css files relative to the root directory sample:
<link rel="stylesheet" type="text/css" href="/css/****.css">
I had this same problem and have found the easiest and most practical solution.
<base href="http://www.example.com/" />
It's super clean and easy to use.
When you use this site.com/name_of_user/
you change the working directory on your site from root
to name_of_user
, therefore the relative path for each file or link on the requested page would become /name_of_user/
instead of /
.
To fix this you need to add additional rule to .htaccess:
RewriteRule ^name_of_user/(.*)?$ $1