hi,
i'm using .htaccess so that the variables passed through links are not seen.

http://localhost/user/jack should be converted to http://localhost/user/?uid=jack

i used:
RewriteRule ^user/([^.]+)/?$ profile/?uname=$1 [NC,L]
whatever characters is input, i want that to be passed and then check.
everything's working perfect.
but when the following symbols are used, the errors such as these are appearing
Forbidden
You don't have permission to access /user/: on this server.

the symbols which are causing the problems are:
%,*,\,:,",<,>

what should i do to avoid this?

Try perhaps this:

RewriteRule ^/?user/([^\.]+)/?$ /profile/index.php?uname=$1 [NC,L]

Also the second part the is where to needs to specify then entire address after the domain so for example the above code assumes the php file is located at yoursite.com/profile/index.php?uname=xxxxx

i used the code you submitted, but still the problem exists.
when i use any of %,<,>,\,", * or : it's showing error

i used the code you submitted, but still the problem exists.
when i use any of %,<,>,\,", * or : it's showing error

Shouldn't those symbols be encoded. Try using the php urlencode function on those symbols to see what the translation should be. That would be the most likely solution because such symbols can't be entered into the url so instead there are codes that are entered which translate into those symbols.

i actually don't want to enter these symbols. i only want a-z, A-Z,0-9 and _. so i'm taking whatever people are inserting, and then checking whether it contains only these. if it contains anything else, it should go to another page.
i'm doing lik this bcos nasty users may enter whatever they want know. thats why i'm doing this.
i tried RewriteRule ^user/([a-zA-Z0-9_]+)/?$ profile/?uname=$1 [NC,L].
but then if i enter any symbols, it's producing error.

Try this

RewriteRule ^user/([a-zA-Z0-9_]+)/?$ profile/?uname=$1 [NC,L]
RewriteRule ^user/([^a-zA-Z0-9_]+)/?$ errorpage.php [NC,L]

And don't forget to make that error page.

i tried this. but still the error is showing.
for example if i use *, it's showing
Forbidden
You don't have permission to access /user/* on this server.
is ther som other problem? lik these symbols are meant for somthin else or somthin?

Try to make sure that it rewrites to the correct location. So could you provide a url link to your php page mentioned in your htaccess file including domain and all.

i'm developing the website. i'm doing this in my computer's server, using localhost. i'm using windows xp.
i checked the location. it's correct.
what to do?

i'm developing the website. i'm doing this in my computer's server, using localhost. i'm using windows xp.
i checked the location. it's correct.
what to do?

Just saw on your first post it is http://localhost/user/jack
Try the following although there are a number of possibilities for this error...

RewriteRule ^/?user/([a-zA-Z0-9_]+)/?$ /profile/?uname=$1 [NC,L]
RewriteRule ^/?user/([^a-zA-Z0-9_]+)/?$ /index.php [NC,L]

also try

RewriteRule ^/?user/([a-zA-Z0-9_]+)/?$ /profile/\?uname=$1 [NC,L]
RewriteRule ^/?user/([^a-zA-Z0-9_]+)/?$ /index.php [NC,L]

i tried both. but still it's showing error

The only other option is the below. If that doesn't work then it means there is something wrong with the apache httpd.conf file. I have experience that myself but can't find how to configure it properly.

RewriteRule ^/?user/([a-zA-Z0-9_]+)/?$ /profile/?uname=$1 
RewriteRule ^/?user/([^a-zA-Z0-9_]+)/?$ /index.php

As I understand there are little recourses regarding this error available but if the above doesn't work its likely to be an apache configuration problem. I'm only good a tweaking apache and not fixing it.

well that didn't worked..
but thanks a lot for giving me your time and trying to help.
if you find out a solution for this problem, pls lemme know

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.