mrtricky Posted July 13, 2009 Share Posted July 13, 2009 Hi, i have an issue with some htaccess mod rewrite code, what i need the script to do is redirect http://www.domain.com/username to http://www.domain.com/profile.php?user=username which i got working but i need a exception if the page is for example http://www.domain.com/signup or http://www.domain.com/help Currently i have this ErrorDocument 404 http://domain.com/ RewriteCond %{HTTP_HOST} !^domain\.com RewriteRule ^(.*)$ http://domain.com/ [R=302] RewriteEngine on RewriteCond %{REQUEST_URI} !help RewriteRule ^([^/\.]+)/?$ profile.php?id=$1 [L] Which kind of works but it goes to a sub folder which isn't what i want really can anyone help??? Quote Link to comment https://forums.phpfreaks.com/topic/165844-mod-rewrite-issue/ Share on other sites More sharing options...
J.Daniels Posted July 13, 2009 Share Posted July 13, 2009 RewriteCond %{REQUEST_FILENAME} !-d does not apply the rewrite rule if the directory exists. Quote Link to comment https://forums.phpfreaks.com/topic/165844-mod-rewrite-issue/#findComment-874815 Share on other sites More sharing options...
mrtricky Posted July 14, 2009 Author Share Posted July 14, 2009 Haven't been able to find any solutions online yet but have kind of fixed the problem myself not sure if its the correct way to do it but it seems to work fine. ErrorDocument 404 http://domain.com/ RewriteCond %{HTTP_HOST} !^domain\.com RewriteRule ^(.*)$ http://domain.com/ [R=302] RewriteEngine on RewriteRule ^(help+)/?$ help.php [L] RewriteRule ^([^/\.]+)/?$ profile.php?id=$1 [L] Quote Link to comment https://forums.phpfreaks.com/topic/165844-mod-rewrite-issue/#findComment-875356 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.