0
Beantwortet

How to configure Ajenti V hosted website with extension less URL

dK Magno vor 9 Jahren aktualisiert von Eugene Pankov (Project coordinator) vor 9 Jahren 4
I am trying ways to configure my website to be extension less. That is when .php or .html files are visited, it'll be redirected to an URL without the extension.

Anyone has successfully configured their Ajenti V with this?

Antwort

Antwort
Beantwortet
It's possible by adding a Custom Configuration code to your content entries. Example: http://stackoverflow.com/questions/19975218/remove-php-from-url-with-rewrite-rule
GUT, ICH BIN ZUFRIEDEN.
Zufriedenheit von dK Magno vor 9 Jahren
Antwort
Beantwortet
It's possible by adding a Custom Configuration code to your content entries. Example: http://stackoverflow.com/questions/19975218/remove-php-from-url-with-rewrite-rule
Hey, thanks!

So I did tried this on my Ajenti V > Websites > my website > Manage > Advanced and pasted:

location / {
try_files $uri $uri.php $uri/;
}

location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
However when I try to visit: www.mywebsite.com/dir/page.php, browser prompts to download "page.php" and it's not showing as a page.

What could I be doing wrong?
Ooops, so I awfully did it wrong. My bad. :)

I was able to get it working now. For the benefit of everyone, who may be also a beginner like me, here's what I did:

I gone through Ajenti V > Websites > my website > Manage > Content and created two (2) PHP Fast CGI entries:

Entry #1

URL pattern:
/
Advanced:
try_files $uri $uri.php $uri/;


Entry #2
URL pattern:
\.php$
Advanced:
include fcgi.conf;

Restart web services and try now. Hope this helps!
The include directive is probably isn't needed here because Ajenti V adds it automatically for all PHP entries. I've posted your config as a KB article here: http://support.ajenti.org/topic/476525-/