Jump to content

Recommended Posts

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???

 

Link to comment
https://forums.phpfreaks.com/topic/165844-mod-rewrite-issue/
Share on other sites

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]

Link to comment
https://forums.phpfreaks.com/topic/165844-mod-rewrite-issue/#findComment-875356
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.