0

So, I am guessing that this question is asked pretty regularly, but I haven't been able to find any answers which will help me out. What I am wanting to do, is to replace the address:

www.site.com/workspace?wid=11

With the address:

wwww.site.com/workspace/11

How would I go about rewriting the URL like this?

1 Answer 1

1

Try this :

RewriteEngine On
RewriteCond %{THE_REQUEST} /workspace\?wid=([^&\s]+) [NC] 
RewriteRule ^ workspace/%1? [NC,R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^workspace/([^/]+)/?$ workspace?wid=$1 [QSA,L,NC]
Sign up to request clarification or add additional context in comments.

3 Comments

The site itself was removed - Instead of www.site.com/workspace/11 it ended up as www.workspace/11
..What url did you enter? This code is working fine on my apache server.
The page is responding with a 404 error, although it's not using my personal 404 page...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.