Apache Web Server
--
Questions
--
Followers
Top Experts
Rewriterule PT flag
I am trying to understand how PT flag actually works
I have gone through this page
http://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_pt
and http://borkweb.com/story/apache-rewrite-cheatsheet
As I observe , specially as per later url where example is like
I modified 2 things in the example
1. removing / forward slash from pattern in the first line as / lets not match pattern with url
2. changed Alias with Redirect or Redirectmatch
so my .htaccess file located at my local server under Applications/AMPPS/www/h/ or http://localhost/h
looks like :
with or without PT , I got same results( finally redirects to http://localhost/ghi which is pretty expected ).
same with another example i tried, which is something like :
that finally redirects to http://localhost/hello
so I am not getting any idea how PT makes a difference while talking in perspective of .htaccess file, mod_rewrite and mod_alias.
I have gone through this page
http://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_pt
and http://borkweb.com/story/apache-rewrite-cheatsheet
As I observe , specially as per later url where example is like
RewriteRule ^/abc(.*) /def$1 [PT]
Alias /def /ghi
I modified 2 things in the example
1. removing / forward slash from pattern in the first line as / lets not match pattern with url
2. changed Alias with Redirect or Redirectmatch
so my .htaccess file located at my local server under Applications/AMPPS/www/h/ or http://localhost/h
looks like :
RewriteRule ^abc /h/def [PT]
Redirect /h/def /ghi
with or without PT , I got same results( finally redirects to http://localhost/ghi which is pretty expected ).
same with another example i tried, which is something like :
Redirect /h/icons /hello
RewriteRule pics/(.+)\.jpg$ /h/icons/$1.jpg
that finally redirects to http://localhost/hello
so I am not getting any idea how PT makes a difference while talking in perspective of .htaccess file, mod_rewrite and mod_alias.
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Are you looking for RedirectMatch statement?
ASKER CERTIFIED SOLUTION
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
I have found solution my own






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Apache Web Server
--
Questions
--
Followers
Top Experts
The Apache HTTP Server is a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards. Typically Apache is run on a Unix-like operating system, but it is available for a wide variety of operating systems, including Linux, Novell NetWare, Mac OS-X and Windows. Released under the Apache License, Apache is open-source software.