|
OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD. |
|
Thread Tools | Display Modes |
|
|||
(solved) how to remove ".php" from urls in httpd?
Is there a way to setup httpd to "rewrite" urls so that user can type "mywebsite.com/register" instead of "mywebsite.com/register.php"?
In lighttpd I do it like this: Code:
url.rewrite-once = ( "^(.*)/$" => "$1/" ) url.rewrite-if-not-file = ( "^([^?]*)(\?.*)?$" => "$1.php$2" ) Last edited by billy_bazooka; 23rd January 2021 at 06:59 AM. Reason: marked as solved |
|
||||
I have not tested this myself, but when request rewrite was added to httpd.conf(5) / httpd(8), this was proposed as the solution:
Code:
location match "/page/(%d+)/.*" { request rewrite "/static/index.php?id=%1" } |
|
|||
Quote:
Code:
location "*.php" { fastcgi socket "/run/php-fpm.sock" } location match "/(%a+)" { request rewrite "/%1.php" } Code:
man patterns |
|
|||
actually, more correct is
Code:
location match "/(%w+)$" { request rewrite "/%1.php" } |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Difference between"arp info overwritten" and " duplicate IP address " | varag | OpenBSD Security | 1 | 6th April 2015 02:57 PM |
How to replace "ectags" with "ctags"? | fender0107401 | OpenBSD Packages and Ports | 5 | 16th April 2013 10:01 AM |
Fixed "xinit" after _7 _8, "how" here in case anyones' "X" breaks... using "nvidia" | jb_daefo | Guides | 0 | 5th October 2009 09:31 PM |
"Thanks" and "Edit Tags". | diw | Feedback and Suggestions | 2 | 29th March 2009 12:06 AM |
can't start apache "httpd not running" | disappearedng | FreeBSD General | 5 | 22nd September 2008 10:18 PM |