The Mask
The Mask

Reputation: 17427

the .htaccess is not working

I'm trying to write a simple .htaccess rule to change

https://webxxx.example.net/~test/id/123

to

https://webxxx.example.net/~test/show.php?id=123

But

https://webxxx.example.net/~test/id/123

is now redirected to my 404 page not found.

my .htaccess:

RewriteEngine on
RewriteRule ^\/?~test\/id\/(\w+)$ /~test/show.php?hash=$1 

Why doesn't this work?

Upvotes: 1

Views: 491

Answers (3)

infojolt
infojolt

Reputation: 5408

I think this is what you want:

RewriteEngine on    
RewriteRule ^id\/([0-9]*)$ /~test/show.php?id=$1

This will just accept numbers after the id.

Upvotes: 0

The Mask
The Mask

Reputation: 17427

The solution:

don't need match the reference of public_html folder in regular expression, only in replace

RewriteEngine onRewriteRule ^id\/(\w+)$ /~test/show.php?hash=$1 

thanks to all :)

Upvotes: 3

iskandarm
iskandarm

Reputation: 109

where is the .htaccess placed ? is it under the main root ? or is it under the subfolder (subdomain) ... try to change the place of the .htaccess and make sure it is under the specific subdomain area .

Upvotes: 1

Related Questions