The WP index.php may not be much, but it’s critical for proper functioning. You cannot just remove it. What is it you are trying to accomplish? What’s objectionable about index.php? Maybe there’s a different approach to address your concerns.
Hi,
I know it is critical for the website to work, I am trying to remove it from the website permalink, the reason is it is not very cosmetic, I want to have permalinks configured to “hangar11.studio/page-name” instead of “hangar11.studio/index.php/page-name”
Ah! I see, sorry for my earlier confusion. It doesn’t belong in permalinks anyway. I’m unsure how it got there to start with. Let’s start with the obvious way. What are your WordPress and site address settings? There shouldn’t be any index.php there, just https;//hangar11.studio. No trailing slash, WP adds that later. Also visit the permalinks settings screen and verify those settings are as you wish. Loading the permalinks screen also causes WP to regenerate its rewrite rules, which is really the main reason for visiting.
If that all checks out, a plugin or theme could be altering your permalinks. Selectively deactivate plugins or switch to a twenty* default theme. Revisit the permalinks settings after each change. When the index.php goes away, whatever you changed last was the cause.
I’d suspect a SEO oriented plugin to alter permalinks before anything else, but I’m unaware of any that would add index.php.
I believe it is caused by how WordPress is set up, I disabled all the plugins but that did not change anything (I only have phlox, Elementor, maichimp and a few related, nothing for SEO). Here is a screenshot of the permalinks settings page. Deleting “index.php” in the custom structure field gives a 404 Error (OpenBSD httpd) when visiting “hangar11.studio/page-name”.
I know this can be fixed somewhere in the httpd.conf file that I included in my original post, with some “rewrite” function, but I have very little knowledge in how to configure httpd so I can’t find a solution. I did not manage to find anyone with a similar problem (and the same setup) after searching far and wide on the web.
WordPress and site address are both https://hangar11.studio
I may be wrong, but I don’t think a lot of those location directives in httpd.conf are necessary. The acme and *.php ones make sense to me. The others, not so much, they should be dealt with by WP internally. I don’t see how they would impact your permalinks, but I’m not that strong with server directives. Don’t forget to restart the server after making changes in that file. And keep backups 🙂
You might look in the site’s virtual hosts file to see if index.php is being added there.
I commented all apart from the acme and *php ones, no change.
I checked some other host file, it only contains the 127.0.0.1 IP.
I really have no idea what is causing this but I was hoping whether it’s possible to do a workaround like when “hangar11.studio/page” is requested it should internally go to “hangar11.studio/index.php/page”, but I have no idea how to configure a “rewrite” rule to do that.
That’ll be hard to do without .htaccess or mod_rewrite
Man, I suffered from some sort of reading comprehension thing when this thread started.
I remove “index.php” from permalink structure
That explains where index.php comes from. It doesn’t belong there. The real question is why does a proper permalink go 404? Answer: no .htaccess or mod_rewrite. Permalinks aren’t supposed to work without those. Your permalinks would need to be like hangar11.studio/?p=3. By inserting index.php into the permalink, you’ve implemented a crude sort of workaround to the lack of mod_rewrite.
Couldn’t you enable mod_rewrite? It should exist as part of Apache, though it may not be enabled by default. It wasn’t enabled on my version of Apache either. I enabled it by placing a sym link in /mods-enabled/ to the rewrite.load file in /mods-available/, then restarted Apache. YMMV.
The inability for WP to write/create .htaccess is a permissions issue. The user PHP runs as needs to be the folder’s owner if permissions are the usual 755. But then you won’t be able edit anything in the folder. So you either need to change permission to 775 or create the file for WP.
Hello,
I’ve been very busy in the last time, now I had a bit of free time and I found something interesting.
Only now do I realize that I do not have Apache. I only have the httpd daemon which is OpenBSD’s web server. I guess it is considered more secure?
I tried changing permissions to 775 instead of 755 but WordPress would not create the .htaccess file, I manually added it (though I think this had no effect as mod_rewrite does not really exist in my setup).
I tried to create a rewrite rule in httpd but the website won’t load properly if I do it like this. If I try to navigate from the cached website I get the permalinks right, but from a browser with no cache the website will load completely broken…
location "*" {
request rewrite "/index.php/"
}
Now, I tried to add these lines of code in .htaccess but it does not anything. If it is possible to somehow do a rewrite rule for the httpd daemon from the .htaccess file then the problem is solved, else I will have to install Apache (which is not officially supported on OpenBSD).