.htaccess internal rewrite rule not working on wordpress links
-
Hello, i have a xampp localhost wp setup. htaccess works, mod_rewrite is on.
The wp pages have multiple hyperlinks inside post body which visitors can click & open in new tab ashttps://localhost/mysite/tickets/Txtxjxxjxcxsx
whereTxtxjxxjxcxsx
is different value for different links & contains numbers,alphabets & special characters like+,/,=
I am trying to internally redirect
https://localhost/mysite/Txtxjxxjxcxsx
tohttps://localhost/mysite/tickets/book.php?id=Txtxjxxjxcxsx
via htaccess but i am not getting any success. I tried the below rule :RewriteEngine on RewriteRule ^tickets/(.*)$ tickets/book.php?id=$1
But i keep getting Error 403 Access Forbidden.
Note when this htaccess rule is active , if i visit directlyhttps://localhost/mysite/tickets/book.php?id=Txtxjxxjxcxsx
, thebook.php
is able to execute & show output but visitinghttps://localhost/mysite/tickets/Txtxjxxjxcxsx
gives Error 403 Access Forbidden.I also tried adding END flag :
RewriteEngine on RewriteRule ^tickets/(.*)$ tickets/book.php?id=$1 [END]
In this case too i get Error 403 Access Forbidden on visiting
https://localhost/mysite/tickets/Txtxjxxjxcxsx
But the new thing i noticed is that when this htaccess rule is active , i get a BLANK PAGE if i directly visithttps://localhost/mysite/tickets/book.php?id=Txtxjxxjxcxsx
.From what i understand in all my previous attempts with htaccess rules , when the server is asked by a visitor to open link
https://localhost/mysite/tickets/Txtxjxxjxcxsx
, it doesnt understand this link as the internal rewrite is not working and as the urlhttps://localhost/mysite/tickets/Txtxjxxjxcxsx
doesnt actually exist it might be showing me that error 403 as its unable to internally redirect tohttps://localhost/mysite/tickets/book.php?id=Txtxjxxjxcxsx
?I am a complete beginner in htaccess stuff, i had been trying to make it work since 2 days but i have not got any success.How to make it work & get the desired result ? Please help me. Thank you
- The topic ‘.htaccess internal rewrite rule not working on wordpress links’ is closed to new replies.