Help! My site is broken, all links go to 404 page now.

_Ken

Joined: 2008-02-11
Posts: 12
Posted: Wed, 2008-08-06 02:32

Drupal: 6.3
Gallery: 2.3 rc1
PHP: 5.2

---
I installed gallery and got it configured the way I wanted to, and then downloaded the gallery module for Drupal.

Going through the set up sections, after I enabled the "URL" rewrite, my entire page stopped working. I can't access /admin, or any other part of the site.

I know it's because of what was added to the top of my .htaccess in my web root directory, because once I commented it out, my site started working again.

However, the URL rewrites are an important part of why I chose to go with Gallery2, so I'd like to try to get whatever the problem is solved.

Here's what was added to the top of the .htaccess:

# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)
#<IfModule mod_rewrite.c>
#    RewriteEngine On

#    RewriteBase /

#    RewriteCond %{REQUEST_FILENAME} -f [OR]
#    RewriteCond %{REQUEST_FILENAME} -d [OR]
#    RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   -   [L]

#    RewriteCond %{HTTP:Authorization} (.+)
#    RewriteCond %{QUERY_STRING} !g2_authorization=
#    RewriteRule .   %{REQUEST_URI}?g2_authorization=%1   [QSA]
#    RewriteCond %{THE_REQUEST} /popular(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_view=dynamicalbum.PopularAlbum   [QSA,L]
#    RewriteCond %{THE_REQUEST} /updates(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_view=dynamicalbum.UpdatesAlbum   [QSA,L]
#    RewriteCond %{THE_REQUEST} /admin/(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_view=core.SiteAdmin   [QSA,L]
#    RewriteCond %{THE_REQUEST} /random(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_view=dynamicalbum.RandomAlbum   [QSA,L]
#    RewriteCond %{THE_REQUEST} /d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /g/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3   [QSA,L]
#    RewriteCond %{THE_REQUEST} /key/([^?/]+)(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_view=keyalbum.KeywordAlbum&g2_keyword=%1   [QSA,L]
#    RewriteCond %{THE_REQUEST} /v/([^?]+)(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_path=%1   [QSA,L]
#    RewriteCond %{THE_REQUEST} /f/([^?]+)(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_controller=permalinks.Redirect&g2_filename=%1   [QSA,L]
#    RewriteCond %{THE_REQUEST} /([^?]+)(\?.|\ .)
#    RewriteCond %{REQUEST_URI} !/index\.php$
#    RewriteRule .   /index.php?q=gallery&g2_view=rewrite.FileNotFound   [QSA,L]
#</IfModule>

# END Url Rewrite section

Here's the rest of my .htaccess:


#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
  Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
  ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On

  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600

  # Do not cache dynamically generated pages.
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment and adapt the following:

RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /

  # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.90.2.1 2008/07/08 09:33:14 goba Exp $

I'm not against tinkering with things to get it working, and browsing around it seems other people have had similar issues (though perhaps not as severe as mine), so any help would be appreciated.

It appears this is what was also added to my .htaccess file in the 'g' (gallery2) directory

 
greenskunk

Joined: 2008-05-02
Posts: 8
Posted: Tue, 2008-08-19 00:30

Could you post the contents of Site Admin -> Maintenance -> System Information ?

 
mascot

Joined: 2009-01-31
Posts: 6
Posted: Sat, 2009-01-31 14:01

My site crashed as well. All except the frontpage now goes to Error 404 page. Nothing works on my site anymore and I can't access the admin area or anything. Only thing different from you is that it seems my .htaccess file is totally gone.

Did you get a solution to your problem here? I need help to get my site back up again

 
greenskunk

Joined: 2008-05-02
Posts: 8
Posted: Sat, 2009-01-31 14:59

@mascot Do you have a backup of your .htaccess?

If not create the .htaccess file from the code below:

---

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On

# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600

# Do not cache dynamically generated pages.
ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on

# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment and adapt the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.90.2.1 2008/07/08 09:33:14 goba Exp $

Not sure if there are many differences but I use Drupal 6

 
mascot

Joined: 2009-01-31
Posts: 6
Posted: Sun, 2009-02-01 15:13

Thank you, that really saved my day!

 
mascot

Joined: 2009-01-31
Posts: 6
Posted: Sun, 2009-02-01 17:23

Now I have a different problem. Any ideas anyone?

I have checked the chmod settings and they are all set to 777 in the g2data folder.
I have tried to redo it again using the lib/support login.
I have cleared the cache
I have checked the path to my g2data folder in the config file.
And I have deleted the folder that was inside the smarty folder. Still I have the same problem. I am using Galery 2.3 and hosting on Hostgator.

First this
warning: fopen(/home/mascotwe/public_html/mascotgallery/g2data/locks/7) [function.fopen]: failed to open stream: No such file or directory in /home/mascotwe/public_html/drupal/mascotgallery/modules/core/classes/GalleryPlatform.class on line 337.

And then this:
Error (ERROR_PLATFORM_FAILURE) : /home/mascotwe/public_html/mascotgallery/g2data/locks/7

* in modules/core/classes/FlockLockSystem.class at line 72 (GalleryCoreApi::error)
* in modules/core/classes/GalleryLockSystem.class at line 95 (FlockLockSystem::_acquireLock)
* in modules/core/classes/helpers/GalleryLockHelper_simple.class at line 62 (GalleryLockSystem::acquireReadLock)
* in modules/core/classes/GalleryCoreApi.class at line 2252 (GalleryLockHelper_simple::acquireReadLock)
* in modules/core/ItemAddAlbum.inc at line 48 (GalleryCoreApi::acquireReadLock)
* in main.php at line 250 (ItemAddAlbumController::handleRequest)
* in main.php at line 104
* in modules/core/classes/GalleryEmbed.class at line 189
* in /home/mascotwe/public_html/drupal/modules/gallery2/gallery_base.inc at line 205 (GalleryEmbed::handleRequest)
* in /home/mascotwe/public_html/drupal/modules/gallery2/gallery.module at line 452
* in ??? at line 0
* in /home/mascotwe/public_html/drupal/includes/menu.inc at line 348
* in /home/mascotwe/public_html/drupal/index.php at line 18