Link to home
Start Free TrialLog in
Avatar of WestCoast_BC
WestCoast_BCFlag for Canada

asked on

Help with .htaccess

What do I need in my .htaccess file so if a user enters the URL:


http://www.mysite.com/thisgroup/ 

And the directory/file thisgroup does not exist I was hoping the user would be redirected to:
http://www.mysite.com/notfound.cfm?group=thisgroup 

thank you for your help
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Just include a directive for the 404 not found error condition:

ErrorDocument 404 http://www.mysite.com/notfound.cfm?group=thisgroup 


Cd&
Avatar of WestCoast_BC

ASKER

Thank for your comment.

thisgroup needs to be a variable.  I need to handle :

http://www.mysite.com/thisgroup/ 
http://www.mysite.com/testgroup
http://www.mysite.com/anothergroup

etc....
Do you want it handled as a 404 not found or a 301 re-direct?  It makes a difference in how the Search engines will treat it.

Cd&
I believe as a 404 not found.
I have sort of solved my problem by changing the rule for my users.  If someone uses:
www.mysite.com/group/thisgroup

I have setup a redirect rule so the above becomes www.mysite.com/group/group=thisgroup

My .htaccess has the following:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule    ^group/([A-Za-z0-9-]+)/?$    /group/?group=$1    [NC,L]

I am hoping that there is an answer to my original question.  

Thank you all for your help.
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial