0

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?

2
Contributors
12
Replies
13
Views
7 Years
Discussion Span
Last Post by anishmsry
0

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

0

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.

0

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.

Edited by anishmsry: n/a

0

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.

0

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?

0

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.

0

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?

0

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]
0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.