0

i have a lot of trouble with a migration. I have moved a beta website to the definitive server: shopfair.eu/ after a lot of issue, i have still 2 problems:

first of all, all the pages are corrupted (not accessible) i.e. http://shopfair.eu/index.php/alimenti-ipocalorici/linea-lazero.html

i have noticed that if i remove /index.php/ from the bar the page exist and is working

http://shopfair.eu/index.php/alimenti-ipocalorici/linea-lazero.html

The other problem is that i cant acces the Admin page... and seems due to the same issue.

I think its an .htaccess or rewrite problem.

Thanks in advance.

my .htacces:

`############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi

#    Action php5-cgi /cgi-bin/php5-cgi
#    AddHandler php5-cgi .php

############################################
## GoDaddy specific options

#   Options -MultiViews

## you might also need to add this line to php.ini
##     cgi.fix_pathinfo = 1
## if it still doesn't work, rename php.ini to php5.ini

############################################
## this line is specific for 1and1 hosting

    #AddType x-mapp-php5 .php
    #AddHandler x-mapp-php5 .php

############################################
## default index file

    DirectoryIndex index.php

<IfModule mod_php5.c>

############################################
## adjust memory limit

    php_value memory_limit 512M
    php_value max_execution_time 18000

############################################
## disable magic quotes for php request vars

    php_flag magic_quotes_gpc off

############################################
## disable automatic session start
## before autoload was initialized

    php_flag session.auto_start off

############################################
## enable resulting html compression

    #php_flag zlib.output_compression on

###########################################
# disable user agent verification to not break multiple image upload

    php_flag suhosin.session.cryptua off

###########################################
# turn off compatibility with PHP4 when dealing with objects

    php_flag zend.ze1_compatibility_mode Off

</IfModule>

<IfModule mod_security.c>
###########################################
# disable POST processing to not break multiple image upload

    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

<IfModule mod_deflate.c>

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    ###SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

    # Netscape 4.x has some problems...
    #BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    #BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    #Header append Vary User-Agent env=!dont-vary

</IfModule>

<IfModule mod_ssl.c>

############################################
## make HTTPS env vars available for CGI mode

    SSLOptions StdEnvVars

</IfModule>

<IfModule mod_rewrite.c>

############################################
## enable rewrites

    #Options +FollowSymLinks
    RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

    RewriteBase /shopfair.eu/

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>


############################################
## Prevent character encoding issues from server overrides
## If you still have problems, use the second line instead

    AddDefaultCharset Off
    #AddDefaultCharset UTF-8

<IfModule mod_expires.c>

############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires

    ExpiresDefault "access plus 1 year"

</IfModule>

############################################
## By default allow all access

    Order allow,deny
    Allow from all

############################################
## If running in cluster environment, uncomment this
## http://developer.yahoo.com/performance/rules.html#etags

    #FileETag none`

2 Answers2

0

Yes, You've rewrite problem. Please make sure your .htaccess file contain below code. If not then please change it.

Please check below code in your .htaccess,

<IfModule mod_rewrite.c>

############################################

## enable rewrites

Options +FollowSymLinks
RewriteEngine on

############################################

## you can put here your magento root folder ## path relative to web root

#RewriteBase /magento (Your Magento Root Folder)

############################################

## uncomment next line to enable light API calls processing

# RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

############################################

## rewrite API2 calls to api.php (by now it is REST only)

RewriteRule ^api/rest api.php?type=rest [QSA,L]

############################################

## workaround for HTTP authorization ## in CGI environment

 RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################

## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]

############################################

## redirect for mobile user agents

#RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
#RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
#RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]

############################################

## always send 404 on missing files in these folders

RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################

## never rewrite for existing files, directories and links

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

############################################ ## rewrite everything else to index.php

RewriteRule .* index.php [L]

 </IfModule>

2) The above code is working perfect in many projects. If it doesn't solve your issue. Try to make your .htaccess file like this--> https://github.com/Creare/magento-htaccess/blob/master/.htaccess

If you can share your .htaccess then i will better solve your issue.

Regards.

Vishwas Soni
  • 467
  • 10
  • 16
  • Hi, i shared my .htacces, still cant solve my issue... Also followsymlinks disabled on my server. – Alessandro Rossi Mar 01 '15 at 12:41
  • To enable the rewrite engine in this context, you need to set "RewriteEngine On" and "Options FollowSymLinks" must be enabled. If your administrator has disabled override of FollowSymLinks for a user's directory, then you cannot use the rewrite engine. This restriction is required for security reasons. Solution : You need to uncomment " #Options +FollowSymLinks" and replace with "Options +SymLinksIfOwnerMatch ". This site may help to solve your SymLinks Settings -->> https://support.terranetwork.net/web/knowledgebase/134/htaccess-options-and-symlink-settings.html – Vishwas Soni Mar 02 '15 at 05:16
  • If followsymlinks is disabled from your server then follow the answer of 'philmck' here-->> https://www.virtualmin.com/node/24753#comment-134776 – Vishwas Soni Mar 02 '15 at 05:33
  • Also disabled: SymLinksIfOwnerMatch... tried to remove /index.php by this method: http://stackoverflow.com/questions/10474740/how-to-remove-index-php-from-urls and still no solution. Maybe i need to try to re-install magento from scratch... – Alessandro Rossi Mar 02 '15 at 10:12
  • That answer doesn't working for me too. But above settings works fine with me. Have you tried " #Options +FollowSymLinks" and replace with "Options +SymLinksIfOwnerMatch " in your .htaccess..??? – Vishwas Soni Mar 02 '15 at 10:28
  • +SymLinksIfOwnerMatch disabled aalso on my server (wedos.cz) they claim 100% support for magento... – Alessandro Rossi Mar 02 '15 at 10:35
  • So, please contact your hosting provider they might solve your issue within a few mins. According to me your .htaccess is OK. – Vishwas Soni Mar 02 '15 at 10:44
  • now, i removed the index.php from urls by the .htaccess, site working but cnt access admin page... :( – Alessandro Rossi Mar 02 '15 at 11:07
  • I've solution for that. Go to phpmyadmin->Select your DB-> find table "core_config_data". Open the table. FInd the lines in the table 1] web/unsecure/base_url 2] web/secure/base_url . If you found index.php from "http://www.example.com/magento/" then remove it. find the index.php in core_resource table also. – Vishwas Soni Mar 02 '15 at 11:56
  • no index.php in urls, admin still resolving in blank page, cant access to the backend... – Alessandro Rossi Mar 04 '15 at 09:36
  • I've last solution for you.. Try your luck. Goto Database->find "core_config_data" table-> Execute the below query in database without quote. "INSERT INTO core_config_data (path, value) VALUES ('web/seo/use_rewrites', 1), ('admin/url/rewrites', 1) ON DUPLICATE KEY UPDATE value=1" . Basically, it'll Enable System > Configuration > Admin > Admin Base URL > Allow URL rewrites. If your server supports rewriting but you cannot enter the admin to make changes then execute this query in the database. – Vishwas Soni Mar 04 '15 at 12:15
0

Because of the disabled function FollowSymLink and +SymLinksIfOwnerMatch on my server, i added the following code to my .htaccess

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

then deleted all the files in the var/cache and var/session folder.

After that the site is working, but the admin now seems not working (blank page).