Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.htaccess file is still broken after all this time #1167

Open
AdzelFirestar opened this issue Jun 21, 2024 · 1 comment
Open

.htaccess file is still broken after all this time #1167

AdzelFirestar opened this issue Jun 21, 2024 · 1 comment

Comments

@AdzelFirestar
Copy link

Describe the bug

After a fresh install and not touching the .htaccess file, it throws out so many apache errors. After editing it a bit for rewrite, it is still broken. I found THIS ANSWER on here from 2018, and it is still a solid solution. For anyone else having issues, the below code from that above link helped me out. Just empty the .htaccess file and put the following code in the same file.

<IfModule mod_rewrite.c>
	RewriteEngine On

	## Uncomment the below "#RewriteBase /" (remove "#") if pH7CMS is installed in a folder, and add the folder name after the slash "/"
	## Example: If pH7CMS is installed in "/public_html/ph7cms/", then it should be "RewriteBase /ph7cms/", however it may depends of your Apache configuration.
	## If you need, please ask your hosting company or check the Apache doc: http://httpd.apache.org/docs/current/mod/mod_rewrite.html

	RewriteBase /
	
	<IfModule mod_env.c>
		# Tell PHP that the mod_rewrite module is ENABLED.
		SetEnv HTTP_MOD_REWRITE On
	</IfModule>

	### For pH7CMS's URL router (DO NOT REMOVE THESE FOLLOWING CODE) ###
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^(.*)$ index.php?$1 [L,QSA]
	#RewriteRule ^(.*)$ init.ph7?$1 [L,QSA]
	
</IfModule>

<IfModule mod_php5.c>
	php_flag allow_url_include Off
	php_flag expose_php Off
</IfModule>


### Security and Spam ###

ErrorDocument 400 /error/http/index?code=400
ErrorDocument 401 /error/http/index?code=401
ErrorDocument 402 /error/http/index?code=402
ErrorDocument 403 /error/http/index?code=403
ErrorDocument 404 /error
ErrorDocument 405 /error/http/index?code=405
ErrorDocument 500 /error/http/index?code=500
ErrorDocument 501 /error/http/index?code=501
ErrorDocument 502 /error/http/index?code=502
ErrorDocument 504 /error/http/index?code=504
ErrorDocument 505 /error/http/index?code=505

# For the videos extensions
#AddType video/ogg .ogg
AddType video/webm .webm
AddType video/mp4 .mp4
AddType application/rss+xml .xml

# Personal pH7CMS extension file
#AddType application/x-httpd-php .ph7
#DirectoryIndex init.ph7

To Reproduce

Steps to reproduce the behavior:

  1. Create a fresh install of pH7
  2. Go to https://www.domain.com/ (Wherever it was installed)
  3. See the following 404 and/or 500 error screens
  4. Rip your hair out trying to find the issue
  5. Profit

Additional Info

  1. I am using the latest Apache and PHP versions as of right now.
  2. I am using the latest composer version.
  3. I am running on a subdirectory but thanks to Plesk, it acts as a root directory.

Expected Behavior

I expected the default .htaccess file to work and the site to load first try.

Screenshots / Screencasts

Before the editing of the .htaccess file:
image

After inputting the new .htaccess file code (Blacked out website name for security and cuz it isn't released yet):
image

@nootkan
Copy link

nootkan commented Jul 12, 2024

Glad it worked for you but it still isn't working for me. Still seeing the 500 error even after trying your new htaccess changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants