| | |
rewrite rule not working
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2008
Posts: 70
Reputation:
Solved Threads: 1
i have problem with rewrite url in .htaccess
i'm used [R] because i can see that mistake..
if i'm type:
http://localhost/web/djardy but it's redirect to :
http://localhost/web/artist.php?artist=artist.php
it's should be redirect to :
http://localhost/web/artist.php?artist=djardy
and i change the .htaccess code, but still not working..
thanks ..
PHP Syntax (Toggle Plain Text)
Options +FollowSymLinks RewriteEngine On RewriteBase /web/ RewriteRule ^([^/]*)$ artist.php?artist=$1 [R]
i'm used [R] because i can see that mistake..
if i'm type:
http://localhost/web/djardy but it's redirect to :
http://localhost/web/artist.php?artist=artist.php
it's should be redirect to :
http://localhost/web/artist.php?artist=djardy
and i change the .htaccess code, but still not working..
PHP Syntax (Toggle Plain Text)
RewriteEngine On RewriteRule ^([^/]*)$ artist.php?artist=$1 [R]
thanks ..
http://www.duniaislam.site50.net
Others Social Bookmarking http://www.bisnis-indonesia.org
Business Web Directory
http://www.bisnis-indonesia.biz
Others Social Bookmarking http://www.bisnis-indonesia.org
Business Web Directory
http://www.bisnis-indonesia.biz
•
•
Join Date: Mar 2008
Posts: 70
Reputation:
Solved Threads: 1
0
#3 Oct 20th, 2009
it's still not working, http://localhost/web/ardy redirect to http://localhost/web/artist.php?artist=artist
and if i used that .htaccess my css site is not working properly..
PHP Syntax (Toggle Plain Text)
Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^([a-z0-9-\s]+) web/artist.php?artist=$1 [R]
and if i used that .htaccess my css site is not working properly..
http://www.duniaislam.site50.net
Others Social Bookmarking http://www.bisnis-indonesia.org
Business Web Directory
http://www.bisnis-indonesia.biz
Others Social Bookmarking http://www.bisnis-indonesia.org
Business Web Directory
http://www.bisnis-indonesia.biz
•
•
Join Date: Oct 2009
Posts: 102
Reputation:
Solved Threads: 18
0
#4 Oct 22nd, 2009
Yeah, your CSS won't work properly because the rewrite rule changes the path for requested files. If you're using relative paths this will mess up your CSS, images and JS.
You can either add rewrite rules for all your CSS and media files or you can access them using the full path starting from your webroot.
Instead of
Use
Or you could write the rewrite rule for your CSS
I'm not sure this is the best way (.htaccess is not my strong suite) but it works. Make sure the paths are correct for you.
You can either add rewrite rules for all your CSS and media files or you can access them using the full path starting from your webroot.
Instead of
PHP Syntax (Toggle Plain Text)
<link rel="stylesheet" type="text/css" href="css/style-admin.css">
PHP Syntax (Toggle Plain Text)
<link rel="stylesheet" type="text/css" href="/web/css/style-admin.css">
Or you could write the rewrite rule for your CSS
PHP Syntax (Toggle Plain Text)
RewriteRule ^([a-z0-9-\s]+)(\.css) web/css/$1.css
I'm not sure this is the best way (.htaccess is not my strong suite) but it works. Make sure the paths are correct for you.
•
•
Join Date: Nov 2009
Posts: 2
Reputation:
Solved Threads: 0
0
#5 Nov 13th, 2009
Hi,
What if I want to apply the rewrite rule to all the css files under the root directory.. I mean there can be multiple directories having css files so I cannot put web/css specifically for below:
RewriteRule ^([a-z0-9-\s]+)(\.css) web/css/$1.css
Instead, can <FilesMatch> be used to serve the purpose?
Eg, If I need to apply a rewrite rule to redirect my css file to a php file I write as below:
<FilesMatch "\.css$">
RewriteRule ^([a-z0-9-\s]+)(\.css) web/css/$1.php
</FilesMatch>
What if I want to apply the rewrite rule to all the css files under the root directory.. I mean there can be multiple directories having css files so I cannot put web/css specifically for below:
RewriteRule ^([a-z0-9-\s]+)(\.css) web/css/$1.css
Instead, can <FilesMatch> be used to serve the purpose?
Eg, If I need to apply a rewrite rule to redirect my css file to a php file I write as below:
<FilesMatch "\.css$">
RewriteRule ^([a-z0-9-\s]+)(\.css) web/css/$1.php
</FilesMatch>
![]() |
Similar Threads
- url rewrite problem (ASP.NET)
- htaccess last rule problem (PHP)
- SEO friendly URLs - Rewrite Map? (PHP)
- friendly url rewrite mod problem (PHP)
- Session problem (PHP)
- htaccess issue (Existing Scripts)
- URL rewrite (*nix Software)
- Apache rewrite map (PHP)
Other Threads in the PHP Forum
- Previous Thread: question
- Next Thread: Show pdf file in web page
Views: 876 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for clean, htaccess, mod_rewrite, url






