- Edited
Via htaccess
RewriteEngine On
RewriteRule ^$ /Forum[L]
Or via php redirect ?
header('Location: '.$newURL.php);
Thanks a bunch in advance
Via htaccess
RewriteEngine On
RewriteRule ^$ /Forum[L]
Or via php redirect ?
header('Location: '.$newURL.php);
Thanks a bunch in advance
NoIdeaWhatThatIs htaccess is more reliable. The header function in php can be unreliable, for instance when headers are already sent due to other errors. The htaccess works on the same level as the webserver vhost file, which is always the best solution.
luceos Thank you!
I just do it with Cloudflare.
A question that comes to mind is why is the redirect needed in the first place? Usually if you install the forum in a subfolder it means you have a main website (for example, WordPress) at the root. If you're not going to use the root path for another app, why not install the forum at the root?
Make sure you are not accidentally exposing private Flarum files if you are doing this because you had issues removing the subfolder. It's always worth a scan to be sure https://discuss.flarum.org/d/10056-migratetoflarum-lab-the-health-scanner-for-flarum
If this is a temporary redirect while waiting for the main website to be published, using a PHP file can be easier to not forget about it when uploading the website, as removing/replacing the file will automatically remove the redirect instead of having to find where it was defined. Don't forget to use a 302 temporary redirect if that's your use case, otherwise visitors won't be able to load the main website if their browser has cached the redirect.
clarkwinkelmann why not install the forum at the root?
Is that still doable for me? like moving the contents of the subfolder onto root just like that? Or does that need a few more steps?
ps: https://lab.migratetoflarum.com is that yours? it's a totally handy ️
NoIdeaWhatThatIs Nvm, i think i found my answer already here: https://discuss.flarum.org/d/2943-moving-forum-to-site-root/31 ️
Edit: didn't worked for me. So there must be a another step :/
NoIdeaWhatThatIs when you move your Flarum contents to root you have to edit your site.php index.php and config.php. You’ll also need to protect your exposed resources either via the built in nginx.conf or .htaccess. More details can here found here
wylzn so if i move directory the folder will be vulnerable?
My flarum (which is sitting in a subfolder) isn't actually live i've just themed it up till now. Wouldn't it be better or less complicated if i just reinstall it fresh onto root and move the plugins from the subfolder into the newly installed flarum?
NoIdeaWhatThatIs you can very easily use your root folder if you follow the docs. I can try to make a quick tutorial video if you’d like?
wylzn Very kind but i decided in the meantime to install flarum onto root. I "just" ( ) had to copy+pasta all settings and theme related stuff, and redownload the plugins manually so it took me just almost 2 hours or such
.
But thanks a lot ️