Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum

Get help for TinyWebGallery, the best image gallery. The forum is also home for the Joomla JFUploader, TWG Flash Uploader and the Wordpress flash uploader.
It is currently 28. Mar 2024, 19:12

This forum is readonly now. Please use the new forum if you don't find the answer to your question here. The new forum is at https://www.tinywebgallery.com/blog/forum/


All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: URL rewrite
PostPosted: 25. Feb 2008, 05:17 
Offline

Joined: 25. Feb 2008, 04:59
Posts: 4
Hello,

I have recently just installed TWG 1.7 and I am having trouble trying to understand how to get the u r l rewrite to work.
I have searched the forums but could not find an explanation.

I am trying to use twg on an intranet, so i have full control over my webserver, but I still cannot get it working. The mod _ rewrite file is definately there.

I have used the example htaccess file from the zip file and adjusted my directory, but with no avail.

Is there something else I am missing? Any help would be great.

I have also noticed that the u r l in the address bar doesnt even show the image number. Is this normal? Could this be my issue?
It shows an twg_foffset=0 at the end


Thanks[code][/code]


Top
 Profile  
 
 Post subject:
PostPosted: 25. Feb 2008, 09:58 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
the url does show the image name. twg_show

and howto 44 explains url rewrite.

/Michael


Top
 Profile  
 
 Post subject:
PostPosted: 26. Feb 2008, 01:15 
Offline

Joined: 25. Feb 2008, 04:59
Posts: 4
I have gone over and over that how to 44, and it doesnt want to show the SEF addresses.

The address bar shows :
ht tp://intranet/gallery/index.php?twg_alb ... _foffset=0.

I understand the album name, but the image name is not there.

I am using the thumbnail scroll thing. Is there a different way to set up that will give me the image name in the address?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: 26. Feb 2008, 02:01 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
you have the skip thumbnail page enabled. Therefore an x is used as image name. Switch to the html mode then you see the full urls.

/Michael


Top
 Profile  
 
 Post subject:
PostPosted: 26. Feb 2008, 03:16 
Offline

Joined: 25. Feb 2008, 04:59
Posts: 4
Thank you for that, now the address shows the image name.

But now when i add the htaccess file to get the SEF urls it says server error.

When reading about the rewriteengine in apache docs, it seems like the htaccess file rules are back to front.

For example: the rule in the htaccess file is:

RewriteRule ^(.*)twg_album/(.*)$ $1gallery/index.php?twg_album=$2 [L,R]


But my understanding of what the apache docs say, this should be opposite and have the "existing" then the "new", such as

RewriteRule ^gallery/index.php?twg_album=(.*) twg_album/$1 [L,R]

or something like that.

Am I completely wrong, or am i missing something that is supposed to run in order for the SEF urls to work?

Thanks again.

EDIT------

I did get rid of the error.... but the sef urls still wont work.
Do i have to set the RewriteBase to something else apart from '/'?
Does it have to doc root?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: 26. Feb 2008, 09:52 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
Hi,

I haven't made more with url rewrite than that.
And this whole thing only works for links you e.g. want to post or include in a different page.

If you surf the gallery the links that are shown in the address bar are not rewritten! TWG would have to be changed completely to achive this!

Maybe you expect too much at this point.

/Michael


Top
 Profile  
 
 Post subject:
PostPosted: 26. Feb 2008, 11:24 
Offline

Joined: 25. Feb 2008, 04:59
Posts: 4
ok. I understand now.

I think that what I was trying to do, if not impossible, but not what your htaccess file does. It does the reverse.
So effectively if i can work out how to reverse it, then i can achieve what i need.

Thanks for your prompt reply and patience.

Regards

/Simon


Top
 Profile  
 
 Post subject: Re: URL rewrite
PostPosted: 3. Apr 2013, 00:18 
Offline

Joined: 26. Jan 2013, 06:16
Posts: 16
well I wanted absolutely nice SEO friendly URLs, so here comes the half-baked solution

ATTENTION: apache epxerts only :-)

I creat 3 top roots: album, image, show
The first 2 point to index.php and show points to ... image.php :-)
The breadcrumbs do not yet work, but lytebox works.

enable mod_substitute in apache
then add this in the config (could also add it into .htaccess, but I added it in the main site config)

Code:
AllowEncodedSlashes On
# anti rewrite the urls to path
# using mod_substitute
<LocationMatch /(album|image)>
AddOutputFilterByType SUBSTITUTE text/html
# href="http://example.com/image.php?twg_album=abc&amp;twg_show=A.jpg">
# href="/show/abc/A.jpg"
Substitute s,href=(['"])(http://[^/]*)?/[^>]*image.php\?twg_album=([^&]*)&amp;twg_show=([^"]*['"]),href=$1$2/show/$3/$4,
#<a href="http://example.com/alXbum/aXbc?twg_album=abc&amp;twg_show=A.jpg">
#<a href="http://example.com/image/abc/A.jpg">
Substitute s,href="([^:]*)://([^/]*)/.*\?twg_album=([^&]*)&amp;twg_show=([^"]*)",href="$1://$2/image/$3/$4",
#<a href="/alXbum/aXbc?twg_album=abc&amp;twg_show=A.jpg">
#<a href="/image/abc/A.jpg">
Substitute s,href=(["'])/[^>]*\?twg_album=([^&]*)&amp;twg_show=([^"]*["']),href=$1/image/$2/$3,
# root all relative URLs to top site URL (that's not compatible with TWG in subdir but works for me)
Substitute s,src=(["'])([^/]),src=$1/$2,
# don't do it for http: at the beginning. yes, ugly... who cares?
Substitute s,href=(["'])([^/h][^t][^t][^p][^:]),href=$1/$2,
# for /dtree/dtree-min.js but still not perfect
Substitute s,\+'buttons,\+'/buttons,

</LocationMatch>
#RewriteCond %{QUERY_STRING} ^twg_album=(.*)&twg_show=(.*)$
#RewriteRule .* /image/%1/%2? [R,L]
#RewriteCond %{QUERY_STRING} ^twg_album=(.*)$
#RewriteRule .* /album/%1? [R,L]

# Do not do anything for already existing files and folders
RewriteCond /home/george/Limbermen/%{REQUEST_FILENAME} -f [OR]
RewriteCond /home/george/Limbermen/%{REQUEST_FILENAME} -d
RewriteRule (.*) - [L]

RewriteRule ^/album/(.*)$ /index.php?twg_album=$1 [L]
RewriteRule ^/image/(.*)/(.*)$ /index.php?twg_album=$1&twg_show=$2 [L]
RewriteRule ^/show/(.*)/(.*)$ /image.php?twg_album=$1&twg_show=$2 [L]


Top
 Profile  
 
 Post subject: Re: URL rewrite
PostPosted: 3. Apr 2013, 09:27 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 11232
Nice - i'll give it a try.


Top
 Profile  
 
 Post subject: Re: URL rewrite
PostPosted: 3. Apr 2013, 18:48 
Offline

Joined: 26. Jan 2013, 06:16
Posts: 16
it's far from perfect... subfolders ain't working either. new version coming in some days.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 27 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
powered by phpbb | Datenschutz/ Privacy policy