Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

HTACCESS RewriteRule problem

NamecheapNamecheap
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

darmar

Established Member
Impact
0
I need some more help....

I can't get to "reuse" variables I'm passing through....

here's my example:
RewriteEngine On
RewriteRule ^[a-zA-Z]{5}$ /test.php?myvar=%1 [R=301,L]

(yes, I'm trying to redirect all "www.example.com/abcde" calls to a specific PHP script, with that "abcde" pass as variable)

with this, I get redirected to: "test.php?myvar=" and no value for this variable "myvar"....

I also tried using "$" instead of "%" in RewriteRule statement - but I get the same....

could anybody post a working example of passing variables to script you're redirecting with RewriteRule ?


thank you
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
try:

Code:
RewriteEngine On
RewriteRule ^([a-zA-Z]{5})$ /test.php?myvar=$1 [R=301,L]
 
0
Close
Yup, that works....

I knew I was close :)
 
0
Close
Glad it worked :D
 
0
Close
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back