Help with .htaccess

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

And the directory/file thisgroup does not exist I was hoping the user would be redirected to: 

thank you for your help
Who is Participating?
COBOLdinosaurConnect With a Mentor Commented:
The real problem is that you want to do it as a 404.  I think with that directive you return a 200 status, and the search engines will probably not like the re-direction.

if you did I 301 re-direct you could use something like:

RewriteRule (http://mysite\.com/)^([^/]+)/?$ $1/notfound\.cfm?id=$2 [r=301,L]

if you want to return the correct status code (404), then you can try is with a page level re-direct and return and try setting the header directly.  

If you just want to get to the page and you are not concern about what status gets sent back, the the way you are doing it is as good as any.  However Google will not like the incorrect status and may penalize the site.

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

ErrorDocument 404 

WestCoast_BCAuthor Commented:
Thank for your comment.

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.

WestCoast_BCAuthor Commented:
I believe as a 404 not found.
WestCoast_BCAuthor Commented:
I have sort of solved my problem by changing the rule for my users.  If someone uses:

I have setup a redirect rule so the above becomes

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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.