URL Rewrite problems

bearnar

Joined: 2007-09-27
Posts: 22
Posted: Thu, 2007-09-27 17:03

Hi!

I´m having some problems configuring the url-rewrites on my wpg2-installation. The strange thing is that I had it all working, but decided to do a clean install of both wordpress and gallery2 when I knew what theme and plugins I needed. When I did that, it suddenly doesn´t work anymore.

I´ve done a clean install again, and noted EXACTLY what I´m doing:

-Downloaded and installed WP2.3 in "C:\web\wordpress", mysql database: wordpress, mysql user: wordpress

-Changed password on wordpress user "admin"

-Enables permalinks with custom structure "/%postname%/"

-Downloaded and installed gallery-2.2.2-full in "C:\web\wordpress\gallery2", mysql database: wordpress, mysql user: wordpress

-Activated URL-rewrite with mod_rewrite on http://www.fjelldal.org/gallery2

-Downloaded and activated WPG2 3.0RC Final

Now on the WPG2-buttons in the admin-panel:

WPG2:

WPG2 Validation Check: Valid (View Page »)
Wordpress Compatible? 	Success
URI to Gallery2 Ok? 	Success
Gallery2 can be located in G2 File Path?	Success
Gallery2 can be initialised?	Success
Gallery2 Version Compatible?	Success
Gallery2 Module: ImageBlock Active?	Success
Gallery2 Module: ImageFrame Active?	Success
WPG2 Output Page Type?	Wordpress
WPG2 Gallery2 Rewrites Status?	Off
Embedded Page is using what Header type?	Simple
Embedded Page is using what Footer type?	Simple
Using Which WPG2 Stylesheet?	Internal

WPG2 Paths:

WPG2 Paths Status: Valid
	
Gallery2 URL: 	http://www.fjelldal.org/gallery2/
URL to your Gallery2 Installation.
Example: http://www.domain.com/gallery2/
URL to WPG2 Output: 	http://www.fjelldal.org/wpg2
Gallery2 File Path: 	C:\web\wordpress\gallery2\
This is the File path to your Gallery2 installation.
Example: /home/username/public_html/gallery2/
On Gallery Error Redirect to: 	http://www.fjelldal.org/index.php
The page you want to redirect to if there is a Gallery login error.
Example: http://www.domain.com/index.php

But now AGAIN, this is where it goes WRONG:

Gallery2 Rewrites:

Gallery2 Rewrite Module: Validation Checklist
Wordpress Permalinks Active?	Yes
Does Gallery2 Rewrite Plugin Exists?	Yes
Can Gallery2 Rewrite Plugin be Activated?	No
Is Gallery2 Rewrite using Apache Mod_Rewrite?	Skipped Due to Previous Failure
Wordpress .htaccess can be updated?	Skipped Due to Previous Failure


Error: Gallery2 Rewrite Plugin cannot be activated

-I get a 500 Internal Server Error, and this .htaccess-file is being created in my C: folder:

# 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} !wpg2$
    RewriteRule .   -   [L]

    RewriteCond %{THE_REQUEST} d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !wpg2$
    RewriteRule .   /gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3   [QSA,L]
    RewriteCond %{THE_REQUEST} v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !wpg2$
    RewriteRule .   /wp-admin/admin.php?page=/wpg2&g2_path=%1   [QSA,L]
</IfModule>

# END Url Rewrite section

I don´t have a clue what to do, and really need my page functional within the next day ;/

Hope this detailed stepbystep makes some sense to some of you guys!

What happens, is that a .htaccess file is being made in my "C:" directory on my server (wordpress is installed at C:/web/wordpress), and I can´t reach a single page on my server (I get the 500 error) until I manually delete that .htaccess file. Then mod_rewrite is disabled again in the gallery.

This is extremly annoing.. any help, please? I´m leaving in a few days for military service, and need my blog up and running!

http://www.fjelldal.org/ - http://www.fjelldal.org/gallery2

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 17:15

Where is your root web page? I'm guessing c:/web

What do you have in Options -> General -> WordPress address (URL): and Options -> General -> Blog address (URL):

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
bearnar

Joined: 2007-09-27
Posts: 22
Posted: Thu, 2007-09-27 17:21

Hi! Thanks for fast response! I really need this fixed by the night.. :O

Yes, my root web page is in C:/web

Both my blog address and wordpress adress in options is http://www.fjelldal.org :

[img]http://bildr.no/thumb/108028.jpeg[/img]

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 17:30

Are the paths in WPG2 Paths blank? The code you posted above shows them as blank.

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
bearnar

Joined: 2007-09-27
Posts: 22
Posted: Thu, 2007-09-27 17:37

Ah, sorry, no, they are not blank, but are like this:

[img]http://bildr.no/thumb/108032.jpeg[/img]

They didn´t follow in the copypaste I did :O

Will edit previous post ;)

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 18:10

I know this is a pain, but can you try reinstalling Gallery2 in c:\web\gallery2\

It shouldn't matter, but since you're in a hurry, my gut feel is that it will work better if they're not nested.

EDIT: Also, I think your WordPress URL should be http://www.fjelldal.org/wordpress/

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
bearnar

Joined: 2007-09-27
Posts: 22
Posted: Thu, 2007-09-27 18:15

Should I use a subdomain to access the gallery then? Like http://gallery2.fjelldal.org ? Or what do you mean?

What should my wordpress url be?

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 18:22

UPDATE: Never mind. I just looked at your site. Your gallery is at http://www.fjelldal.org/gallery2/main.php Which means that the path shown, C:\web\wordpress\gallery2\, is incorrect. Please verify that your gallery is actually currently installed at C:\web\gallery2\

I hit the submit button too early before. Your WordPress URL should be http://www.fjelldal.org/wordpress/

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
bearnar

Joined: 2007-09-27
Posts: 22
Posted: Thu, 2007-09-27 18:27

OK, no I´ve deleted it all, and is about to install everything again. Yes, my gallery is/was at http://www.fjelldal.org/gallery2/main.php, but it is also correct that it is/was installed at c:/web/wordpress/gallery2.

This is my virtual host in httpd.conf:

<VirtualHost *:80>

DocumentRoot /web/wordpress
ServerName www.fjelldal.org

</VirtualHost>

You see? What do you want me to do now that I is about to install it all again?

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 18:49
bearnar wrote:
<VirtualHost *:80>

DocumentRoot /web/wordpress
ServerName www.fjelldal.org

</VirtualHost>

Ahh, that's what's messing it up. Please delete that virtual host.

To have your blog at another address than where it is actually installed, you need to follow these directions: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

Then install G2 at c:\web\gallery2

Your WordPress address (URL) will be http://www.fjelldal.org/wordpress

Your Blog address (URL) will be http://www.fjelldal.org

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
bearnar

Joined: 2007-09-27
Posts: 22
Posted: Thu, 2007-09-27 20:07

Hmm, I´ll try it, then get back to you in this post later this evening :)

 
bearnar

Joined: 2007-09-27
Posts: 22
Posted: Thu, 2007-09-27 20:18

How am I supposed to install wordpress on www.fjelldal.org when I can´t reach c:/web/wordpress on www.fjelldal.org while my virtual host is no longer there? do I need another vhost?

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 20:25

Sorry, make it refer to your web root:

<VirtualHost *:80>

DocumentRoot /web
ServerName www.fjelldal.org

</VirtualHost>

Then c:\web\wordpress will be http://www.fjelldal.org/wordpress

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
bearnar

Joined: 2007-09-27
Posts: 22
Posted: Thu, 2007-09-27 20:52

Okay, I´ve done the following:

used your vhost-example

installed wordpress on www.fjelldal.org/wordpress (c:/web/wordpress)

changed blog url to www.fjelldal.org (wordpress url still www.fjelldal.org/wordpress

copied index.php and .htaccess in my root.

edited index.php

Now, look at www.fjelldal.org

What up?..

Edit: Also tried to install wordpress in my root (c:/web), then move core files to /wordpress, and change wordpress url to www.fjelldal.org/wordpress. copied and changed index.php and .htaccess aswell, page still looks the same, no css, nothing works..

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 21:34

Try updating your permalinks.

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
bearnar

Joined: 2007-09-27
Posts: 22
Posted: Thu, 2007-09-27 21:48

Okay, this is the exact prosedure I´m doing right now:

1. Extracts wordpress files in c:/web
2. Installs wordpress via www.fjelldal.org (vhost points www.fjelldal.org -> c:/web)
3. Logging in as admin
4. Changing permalinks to Date and name based
5. Create a folder "wordpress" in c:/web
6. Changing WordPress address (URL) to http://www.fjelldal.org/wordpress, and leaving Blog address (URL) at http://www.fjelldal.org
7. Hit the update button. I get a page with no css and nothing..
www.fjelldal.org suddenly have no css or anything, cannot access wp-admin or anything.
8. Moving all wordpress files to c:/web/wordpress folder, copy over .htaccess and index.php to c:/web.
9. Editing index.php.
10. Still nothing works on www.fjelldal.org. No CSS, no nothing. Can access wp-admin from www.fjelldal.org/wordpress/wp-admin though, but nothing else.
11. Trying to update permalinks from www.fjelldal.org/wordpress/wp-admin, no success.

This has become a much bigger issue then expected.. :/

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 21:52

Extract the wordpress files in c:\web\wordpress. (If you do it in c:\web and then move it, it won't work.)

Then move index.php to c:\web and do the rest per the instructions.

(My family website runs this way, so I know it works. Just gotta get the steps exactly right...)

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
bearnar

Joined: 2007-09-27
Posts: 22
Posted: Thu, 2007-09-27 22:24

There seems to be a problem with the standard theme in wordpress while doing this prosedure, changing the theme before starting it, makes it work.

Ok, so i got wordpress url : www.fjelldal.org/wordpress, and blog url : www.fjelldal.org, everything working so far, accuratly installed according to your post.
Permalinks activated.

Now, there´s the wpg2 part (which is my original problem!)
I´ve extracted g2 in c:/web/gallery2, and installed via www.fjelldal.org/gallery2
(Should I activate mod_rewrite on the gallery now, because it can be done, or wait?)
Installed and activated wpg2

WPG2 Validation Check: Valid (View Page »)
Wordpress Compatible? 	Success
URI to Gallery2 Ok? 	Success
Gallery2 can be located in G2 File Path?	Success
Gallery2 can be initialised?	Success
Gallery2 Version Compatible?	Success
Gallery2 Module: ImageBlock Active?	Success
Gallery2 Module: ImageFrame Active?	Success
WPG2 Output Page Type?	Wordpress
WPG2 Gallery2 Rewrites Status?	Off
Embedded Page is using what Header type?	Simple
Embedded Page is using what Footer type?	Simple
WPG2 Paths Status: Valid
	
Gallery2 URL: 	http://www.fjelldal.org/gallery2/
URL to your Gallery2 Installation.
Example: http://www.domain.com/gallery2/
URL to WPG2 Output: 	http://www.fjelldal.org/wpg2
Gallery2 File Path: 	C:\web\gallery2\
This is the File path to your Gallery2 installation.
Example: /home/username/public_html/gallery2/
On Gallery Error Redirect to: 	http://www.fjelldal.org/index.php
The page you want to redirect to if there is a Gallery login error.
Example: http://www.domain.com/index.php

BUT AGAIN, WHEN PRESSING THE REWRITE BUTTON;

Gallery2 Rewrite Module: Validation Checklist
Wordpress Permalinks Active?	Yes
Does Gallery2 Rewrite Plugin Exists?	Yes
Can Gallery2 Rewrite Plugin be Activated?	No
Is Gallery2 Rewrite using Apache Mod_Rewrite?	Skipped Due to Previous Failure
Wordpress .htaccess can be updated?	Skipped Due to Previous Failure


Error: Gallery2 Rewrite Plugin cannot be activated
WPG2 cannot remotely activate the Gallery2 Rewrite Plugin. Please manually configure the Gallery2 Rewrite Plugin from the Gallery2 Site Admin Plugin Panel.

And I get a 500 Internal server error, and a .htaccessfile that looks like this in my C: :

# 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} !wpg2$
    RewriteRule .   -   [L]

    RewriteCond %{THE_REQUEST} d/([0-9]+)-([0-9]+)/([^/?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !wpg2$
    RewriteRule .   /gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=%1&g2_serialNumber=%2&g2_fileName=%3   [QSA,L]
    RewriteCond %{THE_REQUEST} v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !wpg2$
    RewriteRule .   /wordpress/wp-admin/admin.php?page=/wpg2&g2_path=%1   [QSA,L]
</IfModule>

# END Url Rewrite section

This was with mod_rewrite enabled in the gallery beforehand. If I don´t install it in the gallery before pressing the Gallery Rewrite-button, I get the same message, but no 500 error nor .htaccessfile. When I THEN try to install and enable it in the gallery, I get the same 500 error and the same .htaccessfile in my C:.

OH MY GOD WHAT IS SO FREAKING WRONG??

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Thu, 2007-09-27 23:03

I can see your problem, the rewritebase has not been set (it is blank). I suspect Gallery2 rewrite module is struggling to construct a ruleset to match your hosting environment thus why the 500.

Can you please check your error_log to see what exactly the 500 error condition is..
____________________________________
Wordpress / Gallery2 (WPG2) Author

 
evilzenscientist

Joined: 2006-11-22
Posts: 29
Posted: Thu, 2007-09-27 23:34

I always have fun with Apache on Windows too :)

I always make WordPress and Gallery work well without any mod_rewrite fun; then start hacking around to make it all look pretty.

While I'm integrating stuff and hacking around with the look and feel there's too much that can go wrong.

I've successfully got about a dozen blogs; four with G2 integration; running on a single box. It's SUSE Linux with Apache 2.2, PHP5, MySQL and the usual stuff.

Can you get the rewrite working for the two independent pieces - WP and G2? Before any integration work?

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Thu, 2007-09-27 23:47

We have had many a issue with Apache rewrites, thus why by default WPG2 disables the module unless the configuration step is take to turn it on. IT is very very tricky to balance Wordpress permalinks with Gallery2 rewrite rules, until 3.0 we could not use an internal Wordpress page because of rewrites breaking each other, it been a very very painful task to get it stable and I am not 100% we will be able to make it work for all types of installs..
____________________________________
Wordpress / Gallery2 (WPG2) Author

 
saffron

Joined: 2008-05-10
Posts: 2
Posted: Sat, 2008-05-10 11:51

Hi,

I cannot get Gallery2 Permalinks to work without breaking all links in my WordPress site.

1. activate plugin WPG2
2. validate address to Gallery2

WPG2 Validation Check: Valid (Help)
1. Wordpress Compatible? - [ Success]
2. URI to Gallery2 Ok? - [Success]
3. Gallery2 can be located in G2 File Path? - [Success]
4. Gallery2 can be initialised? - [Success]
5. Gallery2 Version Compatible? - [Success]
6. Gallery2 Module: ImageBlock Active? - [Success]
7. Gallery2 Module: ImageBlock Version Compatible? - [Success]
8. Gallery2 Module: ImageFrame Active? - [Success]
9. Gallery2 to WPG2 Relative Path Validate? - [Success]
WPG2 Page Generation Rules: (View WPG2 Output Page »)
1. WPG2 Output Style? - [Look like a Gallery2 Page]
2. WPG2 Gallery2 Rewrites Status? - [Off [Safe]]
3. Embedded Page is using what Header type? - [Simple]
4. Embedded Page is using what Footer type? - [Simple]
5. Using Which WPG2 Stylesheet? - [Internal]

Everything works fine at this point.

Then if I activate the re-write Plugin, the Gallery2 permalinks become 'pretty', but every single link in my wordpress site no longer works - and reverts to a Gallery2 page.

I then have to deactivate plugin, clean-out .htaccess and start over to get things working again.

I've tried updating the permalinks in Wordpress - without success
and setting Gallery2 to write the permalinks - but that gives the admin error as WordPress explains.

Any help would be greatly appreciated.

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Sat, 2008-05-10 12:43

Unfortunately their is very little we can do to help with most rewrite issues as the success or failure is highly dependant on the many configuration options that make up the Hosting Environment, thus this is something we ultimately have no control over..

My recommendations would be to please ensure that you use the default Gallery2 rewrite rules, unless you have a pretty clear understanding of how your change will impact the rewrite rule, as changing the Rewrite Rules is which is the usual first place that things get "unstuck"

WPG2 3.06 has an advanced debug logging capability, if you want, please post the BTEV event log from when you visit the WPG2 Gallery2 Rewrite Validation Tab, including activation as the log will have a number of key settings that could help pin pointing certain behaviours.

____________________________________
Wordpress / Gallery2 (WPG2) Plugin, , WPG2 Documentation, WPG2 Demo

 
agoela

Joined: 2008-06-29
Posts: 25
Posted: Sun, 2008-06-29 14:58

This may be 2 months old, but did you check your httpd error log? What probably was happening, was that permissions were incorrect to run the rewrite command. That is the same issue that I had and I just had to set the ModifyOptions to all.