How to test rewrite

Pinguin

Joined: 2005-09-27
Posts: 210
Posted: Wed, 2013-02-13 18:00

It is a long time ago, that I installed a gallery. Where can I test with 3.04 that rewrite works?

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sat, 2013-02-16 14:19

No idea what you're asking.

 
Pinguin

Joined: 2005-09-27
Posts: 210
Posted: Sat, 2013-02-16 15:05

In Gallery 2 there was an option, if the Apache rewrite module works. Can this be testet with G3 too?

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sat, 2013-02-16 19:16

I don't know that there's a module to test it, but you can easily see if you have rewrite on the server.

Back up everything.
Rename your .htaccess file to something else.
Create a new file with this in it, save it as .htaccess, and add it to your root folder:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*) http://galleryproject.org/node/110922 [NC,L]
</IfModule>

Visit your website and see what happens. If you get redirected here, it works.

(Be sure to put everything back afterwards, or your site will be down.)

EDIT: I think the php info page also lists all install modules: http://codex.galleryproject.org/Gallery3:FAQ#How_do_I_create_a_phpinfo_page.3F

 
Pinguin

Joined: 2005-09-27
Posts: 210
Posted: Sat, 2013-02-16 20:26

Thanks, now I know it works, but before I did forget to enable it for apache and I searched at other places. So I asked if there is a tool to check it.

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sun, 2013-02-17 13:14

I used (and still use) Gallery2 some, but I've never used the tool to check rewrite. Thanks for asking; the answer may help others.

 
Pinguin

Joined: 2005-09-27
Posts: 210
Posted: Sun, 2013-02-17 14:14

Setting up a server needs a lot of configuration, but with Ubuntu most things are activated automatically, so I forgot it. You need to execute "a2enmod rewrite". That*s all. Compare eg http://www.dscripts.net/2009/01/19/how-to-enable-mod-rewrite-in-apache-server/ I didn't notice it, because at first sight, the gallery seemed to work.

 
bhonhoff
bhonhoff's picture

Joined: 2008-04-05
Posts: 11
Posted: Tue, 2013-03-05 23:10

I've moved my server to a new version of Ubuntu LTS and on the new installation I am facing the same 'rewrite' problem as described above.
If I run /var/www# a2enmod rewrite I get "Module rewrite already enabled" back.

I've tried the .htaccess test above, but it doesn't seem to redirect. So apparently it is active, but somewhere disabled.

I've added "RewriteEngine On" in the httpd.conf in /etc/apache2/

the phpinfo() doesn't provide much more information as in the php.ini from apache2.
It does mention url_rewrite but not mod_rewrite as I was expecting.

Any idea's?

 
Pinguin

Joined: 2005-09-27
Posts: 210
Posted: Tue, 2013-03-05 23:40

Did you restart apache? Try to shut down the server completely and start it again or reboot it, but sometimes shutdown is better.

 
bhonhoff
bhonhoff's picture

Joined: 2008-04-05
Posts: 11
Posted: Wed, 2013-03-06 22:12

Yes, I've restarted Apache. And rebooted the server as well. (Although it should not be necessary on an Ubuntu machine)

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Fri, 2013-03-15 13:43
bhonhoff wrote:
I am facing the same 'rewrite' problem as described above

Maybe I'm reading too quickly, but I don't know what the problem is. The OP was looking for a way to see if rewrites were active, but not really facing a "problem," as I understood it.

Reading your post, I'm assuming your issue is that your rewrites aren't working and, therefore, your G3 install doesn't work. Correct?

I'd need more info to assist any further--especially if you have server access and have made changes to config/Apache files.

Try removing any and all htaccess files that you've added. Then test a single basic rewrite (redirecting your entire site somewhere else).

 
bhonhoff
bhonhoff's picture

Joined: 2008-04-05
Posts: 11
Posted: Fri, 2013-03-15 13:48

Thanks for the suggestion. I will do that this evening, after taking it of the world wide web. Keep you informed.

 
bhonhoff
bhonhoff's picture

Joined: 2008-04-05
Posts: 11
Posted: Mon, 2013-05-20 07:47

Hi, Solved!

It turned out that the culprit was /etc/apache2/sites-available/default.

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

After changing
AllowOverride None
to
AllowOverride FileInfo Options

a $sudo service apache2 reload

did it for me.