.htaccess help required to change URL

The problem is as following:

I have the domain http://www.lauravink.in.
Laura Vink is me, and I want to use this website to show of pictures from my travels. I choose the .in domain so I could use folders of where I've been; for example: http://www.lauravink.in/poland

For my photos to show I want to use (ofcourse) Zenphoto. I don't want to upload a new ZenPhoto CMS to every folder, but just ones, in the folder /gallery, so I could manage my pictures (and layout) from one place (and also saves webspace).

But if I use ZenPhoto in the galleryfolder (or root), than the URL of a album would be something like: http://www.lauravink.in/gallery/index.php?album=poland, instead of the http://www.lauravink.in/poland/ as I would like it to be.

I know it is possible to rewrite the URL with the .htaccess, but I think it's so difficult! Could someone please help me?

I thought of something like:

RewriteRule ^index\.php?album\=(.*)$ /$1/ [R]

in the .htaccess folder, but this doesn't work..

Thank you very much.

Laura Vink
http://www.lauravink.nl

Comments

  • acrylian Administrator, Developer
    htaccess is a tricky thing.. I fear I can't help with that currently. The easiest would be to install Zenphoto in the root. I see you use also Pixelpost, since that is in a subfolder it might be possible to do that depending on how the index page is named and created.
  • Installing Zenphoto in the root is ofcourse also an option if it makes it easier.
    Then the only thing that needs be replace is

    lauravink.in / index.php?album=paris to lauravink.in / paris.

    But still.. how?

    I won't be using Pixelpost, I do use this in my .nl domain, but I won't in my .in domain (where this topic is about).

    I hope some else can help me with it!
  • acrylian Administrator, Developer
    Ok, I of coures don't know how your site is setup in detail but for the blog you use Pixelpost. Anyway, I would say just install Zenphoto in the root, that is the easiest solution. The you will get exactly what you need. Zenphoto runs absolutly fine in the root.
  • I've installed Zenphoto in the root and have made an new .htaccess.
    It still doesn't work though. I have no idea what I'm doing wrong.

    My .htaccess looks like this

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.lauravink.in$ [NC]
    RewriteRule ^(.*)$ http://lauravink.in/$1 [R=301,L]

    RewriteRule ^index\.php?album\=(.*)$ $1 [R]

    Any ideas anyone?
  • I just found out that I do need to edit the .htacces that comes with the setup. Now my .htaccess looks like this:

    # htaccess file version 1.2.2.0;
    # Update the above and the define in setup.php when you make changes to the rewrite rules!
    # NOTE: Change the RewriteBase below to the absolute path to your zenphoto directory. (Or let setup.php do it for you!)

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.lauravink.in$ [NC]
    RewriteRule ^(.*)$ http://lauravink.in/$1 [R=301,L]

    #### !!! Change this to the web path (eg: http://www.yourwebsite.com/photos --> /photos) !!!
    RewriteBase /
    ####

    RewriteRule ^admin/?$ zp-core/admin.php [R,L]

    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^albums/?(.+/?)?$ $1 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [L]

    RewriteRule index\.php$ index.php [L,QSA]
    RewriteRule ^page/([0-9]+)/?$ index.php?page=$1 [L,QSA]
    RewriteRule ^page/([A-Za-z0-9\-_]+)/?$ index.php?p=$1 [L,QSA]
    RewriteRule ^page/([A-Za-z0-9\-_]+)/([0-9]+)/?$ index.php?p=$1&page=$2 [L,QSA]
    RewriteRule ^(.*)/page/([0-9]+)/?$ index.php?album=$1&page=$2 [L,QSA]
    RewriteRule ^(.*)/page/([A-Za-z0-9\-_]+)/?$ index.php?album=$1&p=$2 [L,QSA]

    #### Rewrite rule addition for search
    RewriteRule ^page/search/fields([0-9]+)/(.*)/([0-9]+)/?$ index.php?p=search&searchfields=$1&words=$2&page=$3 [L,QSA]
    RewriteRule ^page/search/fields([0-9]+)/(.*)/?$ index.php?p=search&searchfields=$1&words=$2 [L,QSA]
    RewriteRule ^page/search/archive/(.*)/([0-9]+)/?$ index.php?p=search&date=$1&page=$2 [L,QSA]
    RewriteRule ^page/search/archive/(.*)/?$ index.php?p=search&date=$1 [L,QSA]
    RewriteRule ^page/search/tags/(.*)/([0-9]+)/?$ index.php?p=search&searchfields=4&words=$1&page=$2 [L,QSA]
    RewriteRule ^page/search/tags/(.*)/?$ index.php?p=search&searchfields=4&words=$1 [L,QSA]
    RewriteRule ^page/search/(.*)/([0-9]+)/?$ index.php?p=search&words=$1&page=$2 [L,QSA]
    RewriteRule ^page/search/(.*)/?$ index.php?p=search&words=$1 [L,QSA]
    #### Rewrite additions for zenpage
    RewriteRule ^pages/?$ index.php?p=pages [L,QSA]
    RewriteRule ^pages/(.*)/?$ index.php?p=pages&title=$1 [L,QSA]
    RewriteRule ^news/?$ index.php?p=news [L,QSA]
    RewriteRule ^news/([0-9]+)/?$ index.php?p=news&page=$1 [L,QSA]
    RewriteRule ^news/category/(.*)/([0-9]+)/?$ index.php?p=news&category=$1&page=$2 [L,QSA]
    RewriteRule ^news/category/(.*)/?$ index.php?p=news&category=$1 [L,QSA]
    RewriteRule ^news/archive/(.*)/([0-9]+)/?$ index.php?p=news&date=$1&page=$2 [L,QSA]
    RewriteRule ^news/archive/(.*)/?$ index.php?p=news&date=$1 [L,QSA]
    RewriteRule ^news/(.*)/?$ index.php?p=news&title=$1 [L,QSA]

    RewriteRule ^(.*)/image/(thumb|[0-9]{1,4})/([^/\\]+)$ zp-core/i.php?a=$1&i=$3&s=$2 [L,QSA]
    RewriteRule ^(.*)/image/([^/\\]+)$ zp-core/i.php?a=$1&i=$2 [L,QSA]
    RewriteRule ^(.*)/album/(thumb|[0-9]{1,4})/([^/\\]+)$ zp-core/i.php?a=$1&i=$3&s=$2&album=true [L,QSA]
    ####

    # Catch-all - everything else gets handled in PHP for compatibility.
    RewriteRule ^(.*)/?$ index.php?album=$1 [L,QSA]

    RewriteRule ^index\.php?album\=(.*)$ $1 [R]

    </IfModule>

    But still not working as I would like to. Should I put it somewhere else in the file?
  • acrylian Administrator, Developer
    Assuming that you at least use the latest official 1.2.2 version you should not need to change anything manually in the .htaccess file. Setup should do that for you. Just use the htaccess file that is included in the download package and run setup (which should run automatically though).
  • Ooooohhhh.. it works!
    I didn't understand it correctly. I thought I would go to the URL lauravink.in/index.php?album=poland and it would change to lauravink.in/poland.

    But I just have to link to the URL lauravink.in/poland and it shows the wright page. :D

    Anyway, thanks for your help acrylian!
  • acrylian Administrator, Developer
    I thought I would go to the URL lauravink.in/index.php?album=poland and it would change to lauravink.in/poland.
    Yes, that is what it actually does. The first url is the one without mod_rewrite/htaccess.
  • hi lauravink.

    just an idea - if you want zenphoto in the root, but not of www.lauravink.com, how about creating a subdomain?

    thats what i did with my site - www.mungler.com is the main site (nothing on there yet) and gallery.mungler.com is the zenphoto subdomain. works a treat :)
  • darkS Member
    Just a note for anyone that might missed it like me.
    Don't forget to tick 'mod_rewrite' under options > gallery configuration for these cruft-free URLs.
    Careless, I was cracking my head thinking why it wouldn't work and eventually get it right by just a simple few clicks. You don't even need to edit .htaccess :)
Sign In or Register to comment.