phpBB 3.2 How to get rid of index.php in URL - without .htaccess?
I've been having great fun with putting a new Forum together using phpBB.  Part I really liked was I could find a theme that was completely mobile friendly and it isn't even using bootstrap.  And also the color I like.  phpBB doesn't have as many bells and whistles as myBB, but I'm beginning to wonder whether all of those fancy tools in myBB are really needed.  Took me a little while, but am now familiar with how the themes/styles and extensions work in the ACP. 

There is something however that is irritating me which is the url has a tag at the end that says index.php or viewtopic.php etc.  I know there's a way to get rid of those with .htaccess, but I've learned that hosts discourage people from using .htaccess because of risks.  So does anyone know of an alternative way to get rid of those url tags.  Like i'd like a straight without Index.php.
What web server are you using?
for nginx:
Writing rewrite rules for that is fairly easy. Just a few regexs.
No. As far as I know.
Quote:I know there's a way to get rid of those with .htaccess, but I've learned that hosts discourage people from using .htaccess because of risks.

I am very sorry, but I'm not trying to attack someone here or something similar. This kind of statement made by providers and other users from the Internet is total nonsense.

The .htaccess file of Apache is the only user customizable configuration file that doesn't require access to the vHost file of the website and/or access to the server to restart Apache to apply settings. It was made for the purpose of allowing users to configure certain parts of their site differently than specified in the main vHost file. This includes the nice URL feature also known as URL rewrite (mod_rewrite). Other features are custom error pages, access restriction through authentication or IP based blacklists and other features. All this without changing anything critical to the security of the web server and without giving access to normal users to the web server files such as vHosts configuration, web server configurations and so on.

The .htaccess method is what every normal webmaster would have to use anyway to create nice URLs and etc on shared hosting environments and similar. Generally you have two options: a) edit the code in the vHost configuration file or b) use .htaccess to customize settings. Option a is impossible if you don't have access to the server files to edit them and you have no permission to restart/reload Apache (which is necessary to apply changes in vHost files). Option b is common and easy to use. It doesn't even require a restart of the web server to apply the wanted changes such as the nice URLs you are looking for. It adds value to a user friendly web server.

Other web servers such as Nginx, Lighttpd and etc don't support this feature and users are required to edit the vHost configuration files (whether it may be directly on the server or through control panels). This is a much bigger security risk than .htaccess because in this case users can mostly change everything (unless limited in the web panel) while in Apache features that can be changed in .htaccess can be limited by default by the server administrator.

So in short: you either use .htaccess or if you have access to the server you apply the rewrite rules in the vHost configuration file of your website. Both have the same effect while .htaccess allows easy application of additional configuration without providing administrative access to users and without having to restart/reload the webserver everytime a change is made.

Apache doesn't recommend using .htaccess ONLY FOR PERFORMANCE REASON. See
Quote:You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance.

The recommendation is however void if you are a normal user on e.g. a shared hosting account without access to the mentioned main server configuration files and/or the vHost configuration file. And these days you won't really feel the performance difference between directly applied rules and rules loaded through .htaccess.
Quote:In general, you should only use .htaccess files when you don't have access to the main server configuration file.

.htaccess files should be used in a case where the content providers need to make configuration changes to the server on a per-directory basis, but do not have root access on the server system. In the event that the server administrator is not willing to make frequent configuration changes, it might be desirable to permit individual users to make these changes in .htaccess files for themselves. This is particularly true, for example, in cases where ISPs are hosting multiple user sites on a single machine, and want their users to be able to alter their configuration.

My question now is: do you have root access to the server where you site is? If so: apply method a and simply add the rewrite rules inside the main vHost configuration file of your website.
Wow @Monad.  That's an awesome post and put things right into perspective for me.  Am happy that .htaccess is OK to use.  I do have root access, but since the shared hosting account is on a shared multi-account cpanel server with an absentee owner I'm doubly conscious and cautious with what I do when I go in as root.  I'm the only one with root access to the server other than the owner.  BTW the hosting is on a very large Hetzner VPS.  So I think in this case I'm going to go for the .htaccess option.  Do you think the rule below in an .htaccess file will be enough - or do you know better rules to include in .htaccess to fix the url? 

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

@Conan  Many thanks for the rewrite rules for Nginx.  Right on the number for me.  In this case there is no nginx but a couple of my VPSs use nginx so I may refer back to this in future.
without htacess this is not possible, therefore you need to apply as mentioned above htaccess rules in order to hide the index page url.
[Image: img.php?userid=5534]

Users browsing this thread: 1 Guest(s)