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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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 :

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.

10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.