One Question about .htaccess ->

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yasinipersian
Forum Newbie
Posts: 3
Joined: Sat Feb 11, 2012 7:57 am

One Question about .htaccess ->

Post by yasinipersian »

Hello

—————
One Question ...
I need to convert this URL
for exampel:{like wordpress}

...../?p=26 ==> ...../user.php?username=26

I use this .htaccess but not work

Options +FollowSymlinks
RewriteEngine On
RewriteRule ?p=([a-zA-Z0-9_-]+)$ user.php?username=$1

please help me …

excuse me my language is persian
if my speaks not true
——————–

THANKS
User avatar
azycraze
Forum Commoner
Posts: 56
Joined: Mon Oct 24, 2011 12:08 pm
Location: India

Re: One Question about .htaccess ->

Post by azycraze »

pls post the full url
yasinipersian
Forum Newbie
Posts: 3
Joined: Sat Feb 11, 2012 7:57 am

Re: One Question about .htaccess ->

Post by yasinipersian »

hello
=======================================
This url is in localhost ....
for example:
localhost/test/?p=26 ==>localhost/test/user.php?username=26
=======================================
thanks
User avatar
azycraze
Forum Commoner
Posts: 56
Joined: Mon Oct 24, 2011 12:08 pm
Location: India

Re: One Question about .htaccess ->

Post by azycraze »

Try this
----------------------------------------------------
RewriteEngine On
RewriteRule ^\?p\=([a-zA-Z0-9_-]+)$ user.php?username=$1
=======================================================

You have to use backslash to use ?,._& etcccc.........
yasinipersian
Forum Newbie
Posts: 3
Joined: Sat Feb 11, 2012 7:57 am

Re: One Question about .htaccess ->

Post by yasinipersian »

One:thanks for your answer :)
Two:this answer dont work for (\?p ....) but when remove (\?) for ( \p ....) work true...

my problem exactly is ===>(?) and dont remove problem this question mark with backslash .... i dont know doing ...
I searched all of the web but not found this way for this problem
Post Reply