NameSilo

HTACCESS RewriteRule problem

Spaceship Spaceship
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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
try:

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

I knew I was close :)
 
0
•••
Glad it worked :D
 
0
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back