Forum Discussion
Convert .htaccess rewrite rules to iRule
- Aug 25, 2022
Hi Walter_WorkAcct...using the htaccess tester, here's a before/after example:
- Original URL: https://test.domain.local/http-path?k1=v1
- Rewritten URL: https://test.domain.local/index.php?p=http-path&k1=v1
The first two rewrite conditions are apache specific for local implementation and should be fine to ignore, but ignoring the favicon needs to be addressed. This results in an iRule that could look something like this (untested, might need adjustment):
when HTTP_REQUEST { set uri [string tolower [HTTP::uri]] if { not (($uri ne "/favicon.ico") or [string match apple-touch-icon*.png $uri]) } { HTTP::uri /index.php?p=[string range $uri 1 end] } }
Hi Walter_WorkAcct...using the htaccess tester, here's a before/after example:
- Original URL: https://test.domain.local/http-path?k1=v1
- Rewritten URL: https://test.domain.local/index.php?p=http-path&k1=v1
The first two rewrite conditions are apache specific for local implementation and should be fine to ignore, but ignoring the favicon needs to be addressed. This results in an iRule that could look something like this (untested, might need adjustment):
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
if { not (($uri ne "/favicon.ico") or [string match apple-touch-icon*.png $uri]) } {
HTTP::uri /index.php?p=[string range $uri 1 end]
}
}
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com