MOD_REWRITE REQUIRED on 1and1 (ionos) shared hosting

William Nevins Posted in Technical Support 4 years ago

Hello!
New to this software, but not new to dev. I'm trying to install OSSN on my shared 1and1 (ionos), and everything passes except for MODREWRITE REQUIRED.
I see the rewrite rules in .htaccess, and MOD
REWRITE is enabled according to 1and1. Any ideas? Here are the rewrite rules in .htaccess:

<IfModule mod_rewrite.c>
#SetEnv HTTP_MOD_REWRITE 1

RewriteEngine on

RewriteRule ^rewrite.php$ installation/tests/apache_rewrite.php [L]

RewriteRule ^action\/([A-Za-z0-9\_\-\/]+)$ system/handlers/actions.php?action=$1&%{QUERY_STRING} [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z0-9\_\-]+)$ index.php?h=$1 [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z0-9\_\-]+)\/(.*)$ index.php?h=$1&p=$2 [QSA,L]

</IfModule>
Replies
Indonesian Arsalan Shah Replied 4 years ago

Good to hear that you found the solution :)
Yes on 1and1 you need to add rewrite base but of course OSSN will overwrite the file unless you edit actual file installation/configs/htaccess.dist

us William Nevins Replied 4 years ago

HA!!! I figured it out! I had to set the permissions of the .htaccess file to 444 so ossn could not overwrite the file, then it was able to move forward. Hope this helps anyone who may be reading this!!!

us William Nevins Replied 4 years ago

What i'm finding is that no matter what I change in the .htaccess, ossn is re-writting the .htaccess back to what it generates. So any changes I do are being wiped out it appears.

us William Nevins Replied 4 years ago

I did add the 'RewriteBase / ' as recommended by the article, but that didn't have any effect. Here is the .htaccess code, it may look weird since this site strips the PHP tags out, but 'it'll give you an idea. I replace <, # and > with ' so you can see the PHP.

 # OpenSource-SocialNetwork
 #
 # @package   (Informatikon.com).ossn
 # @author    OSSN Core Team <[email protected]>
 # @copyright 2014 iNFORMATIKON TECHNOLOGIES
 # @license   General Public Licence http://opensource-socialnetwork.org/licence 
 # @link      http://www.opensource-socialnetwork.org 
Options -Indexes
Options +SymlinksIfOwnerMatch
DirectoryIndex index.php

'Files "error_log"'
    order allow,deny
    deny from all
'/Files'

'FilesMatch "(nginx|htaccess).dist"'
    order allow,deny
    deny from all
'/FilesMatch'

'IfModule mod_mime.c'
    AddType image/vnd.microsoft.icon .ico
'/IfModule'

'IfModule mod_expires.c'
    ExpiresActive On
    ExpiresDefault "access plus 1 year"
'/IfModule'

'FilesMatch "\.(jpg|jpeg|gif|png|mp3|flv|mov|avi|3pg|html|htm|swf|js|css|ico)$"'
    FileETag MTime Size
'/FilesMatch'

'IfModule mod_rewrite.c'

    RewriteEngine on
    RewriteBase /
    RewriteRule ^rewrite.php$ installation/tests/apache_rewrite.php [L]
    RewriteRule ^action\/([A-Za-z0-9\_\-\/]+)$ system/handlers/actions.php?action=$1&%{QUERY_STRING} [L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([A-Za-z0-9\_\-]+)$ index.php?h=$1 [QSA,L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([A-Za-z0-9\_\-]+)\/(.*)$ index.php?h=$1&p=$2 [QSA,L]

'/IfModule'

'IfModule mod_php5.c'
    php_value memory_limit 128M
    php_value register_globals 0
    php_value post_max_size 8388608
    php_value upload_max_filesize 5242880
    php_value default_charset "UTF-8"
'/IfModule'

'IfModule mod_php7.c'
    php_value memory_limit 128M
    php_value register_globals 0
    php_value post_max_size 8388608
    php_value upload_max_filesize 5242880
    php_value default_charset "UTF-8"
'/IfModule'
us William Nevins Replied 4 years ago

Hello,
I've checked the URL you sent and the information there didn't fix the issue. I was able to confirm that modrewrite was turned on by adding a redirect in the .htaccess file and forwarding a page that confirmed modrewrite was working. If it wasn't, it should not have forwarded the URL.

I did build a php_info page as well, but what is weird, is that it's not showing any modules loaded, which may be a security feature? I know that ossn generates a .htaccess file when first accessed, and it appears correct. So i'm kind of at a loss at the moment. I tried attaching the entire .htaccess code here, but this website removed all of the PHP tags, so i'm not sure if that is useful.

Any ideas?

us William Nevins Replied 4 years ago

Interesting, I was googling for at least an hour on this, and searched 1and1's site and didn't come across this. I'll followup on it and report back, thank you for your help!