Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How to add ".html" extension in the links?
jenis
New
I have installed the vanilla forums inside a sub-directory and all things are working fine.
Now due to some requirements, I need to add ".html" to every link so would appreciate if you guys can help here.
THis is my current Nginx file.
`server {
listen 80;
listen [::]:80;
server_name dev.vanilla.com; root /var/www/html/vanilla; index index.php index.html index.htm; # Root location location = / { return 301 /forum/; } location /forum { try_files $uri $uri/ @vanilla; } location @vanilla { rewrite ^/forum(.+)$ /forum/index.php?p=$1 last; } location ~ \.php$ { fastcgi_pass unix:/run/php/php7.1-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; #fastcgi_param X_REWRITE 1; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; }
}`
My vanilla version is 2.6.x
0
Comments
https://ecosia.org/search?q=rewrite+url+nginx+add+html
For me it is the third result in the list.
this is not going be viable generally on the server level as the only way of doing this would be to modify the response, which is not something that is gernally done on single server setups. CDNs might do this and some tiered setup occasionally, but not usually for this reason.
This is not a question for server rules, you need to change the urls in the page which is inherent to how they are routed.
https://open.vanillaforums.com/discussions.html doesn't work
you can route things to ignore the html part but that it not the point.
What are the requirements? I suggest they aren't warranted and may be based on incorrect assumptions.
grep is your friend.
you can do somethign like this.
https://www.garron.me/en/bits/add-html-extension-nginx-apache-htaccess.html
but this redirecting not actual changing the link in the page. Someone might do this if they had imported from another system. But it would not be efficient for every link.
grep is your friend.