RyosukeGunma 0 Report post Posted January 27, 2011 Hi, I decided to try some clean url (mod_rewrite) in my project. The clean url works but the CSS and images could not be found.e.g: From index.php?id=home&idPage=1 to /home/1 . My CSS was redirect to /home/css/styles.css and not css/styles.cssIs there any way to fix that? Share this post Link to post Share on other sites
web_designer 7 Report post Posted January 27, 2011 Hi, I decided to try some clean url (mod_rewrite) in my project. The clean url works but the CSS and images could not be found.e.g: From index.php?id=home&idPage=1 to /home/1 . My CSS was redirect to /home/css/styles.css and not css/styles.cssIs there any way to fix that? hi,i did a quick search on google and came up with this. mod_rewrite should ignore some directories (like images and css directories). so try this code and post here to know if it worked for youRewriteCond %{REQUEST_URI} ^/(cgi-bin|css|images)/?. or try this oneRewriteRule ^(|css|images|) - [L] hope you luck. Share this post Link to post Share on other sites
Parubilla 0 Report post Posted January 30, 2011 Same happen to me once, and it was like a glitch the only solution I could find was to reinstall (I believe you are talking about Joomla!), the latest version and it worked.And it also happened to me, that when I put different languages, the css would also stop working. Share this post Link to post Share on other sites
vhortex 1 Report post Posted February 3, 2011 The best way and fastest method to solve it is to append / on the CSS path. A mod_rewrite rule when properly written will ignore existing files and directories while HTML css will be search on the rewritten URL.Example: A mod rewritten URL like this http://mynewserver.com/mycategory/myatriclename Will have its CSS search at http://mynewserver.com/mycategory/myatriclename/cssfilename.css Appending a / on the CSS path like this <link rel="stylesheet" href="/comments.css" type="text/css" media="screen" /> or even putting the full URL like this <link rel="stylesheet" href="http://mynewserver.com/comments.css" type="text/css" media="screen" />always fixes the problem. For CSS images, do take note that they are being read relative to the stylesheet folder.Since you are doing some mod_rewrite and .htaccess modification, maybe this article can add some help in the future Essential .htaccess Commands, if the link is useful to you, I will appreciate dropping a comment. Share this post Link to post Share on other sites
Quatrux 4 Report post Posted February 7, 2011 Another way to do it, even though it usually is a less smooth way is to make one string.The rewrite rule could look something like this: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?mygetkey=$1 [QSA,L]</IfModule> and you would have nice clean URL, but in PHP you could access the string through $_GET['mygetkey']; which would have all the line, for example 'home/category/article/id' but in this case you would need to get your parameters yourself, usually I just create a navigation class which makes everything simple on later usage.Mod rewrite is really powerful, there are plenty ways to do things, just you need to find the solution you need. Share this post Link to post Share on other sites
RyosukeGunma 0 Report post Posted February 24, 2011 Thanks everyone. I have tried RewriteRule ^(|css|images|) - [L] and it didn't work. I managed to get the CSS working by putting a slash / on every src, which is a bit long but still worth it.Does anyone know if it's possible for mod rewrite to get access a MySQL table and get data? I was thinking to put a custom fieldname in a MySQL table so we could put our own clean URL. A lot of CMS like Joomla can put their own custom URL. Share this post Link to post Share on other sites
angelacat 0 Report post Posted July 4, 2011 I have experienced this issue yesterday.With clean-urls enabled I have discovered that if any drupal webpage has more than one arg in the url, then images linked relative to the site don't appear.When clean-urls are disabled, the images work on every pages. If you get any ideas, please share with us. Share this post Link to post Share on other sites