pH7-Social-Dating-CMS icon indicating copy to clipboard operation
pH7-Social-Dating-CMS copied to clipboard

.htaccess file is still broken after all this time

Open AdzelFirestar opened this issue 1 year ago • 4 comments

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

AdzelFirestar avatar Jun 21 '24 16:06 AdzelFirestar

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.

nootkan avatar Jul 12 '24 04:07 nootkan

Thank you for this. However, the ph7cms v18.0 has a strange problem apart from what you solved. It doesn't allow users to select gender, age, description and other important info during registration. It simply takes users to login page after they have filled in username, email and password.

This is NOT the case when I run the script on my localhost. It works flawlessly but as soon as I upload to webserver and install, it brings up that issue again.

SosthenesAlpha avatar Jan 07 '25 06:01 SosthenesAlpha

This worked for me after many hours of trying to change my Apache config files!

gupp41 avatar Jan 17 '25 05:01 gupp41

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.

Did you ever get this fixed? I am having the same issue

kobaltic avatar Mar 04 '25 20:03 kobaltic