Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum https://www.tinywebgallery.com/forum/ |
|
URL rewrite https://www.tinywebgallery.com/forum/viewtopic.php?f=1&t=1402 |
Page 1 of 1 |
Author: | smacca20 [ 25. Feb 2008, 05:17 ] |
Post subject: | URL rewrite |
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] |
Author: | TinyWebGallery [ 25. Feb 2008, 09:58 ] |
Post subject: | |
the url does show the image name. twg_show and howto 44 explains url rewrite. /Michael |
Author: | smacca20 [ 26. Feb 2008, 01:15 ] |
Post subject: | |
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 |
Author: | TinyWebGallery [ 26. Feb 2008, 02:01 ] |
Post subject: | |
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 |
Author: | smacca20 [ 26. Feb 2008, 03:16 ] |
Post subject: | |
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 |
Author: | TinyWebGallery [ 26. Feb 2008, 09:52 ] |
Post subject: | |
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 |
Author: | smacca20 [ 26. Feb 2008, 11:24 ] |
Post subject: | |
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 |
Author: | georgelotus [ 3. Apr 2013, 00:18 ] |
Post subject: | Re: URL rewrite |
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&twg_show=A.jpg"> # href="/show/abc/A.jpg" Substitute s,href=(['"])(http://[^/]*)?/[^>]*image.php\?twg_album=([^&]*)&twg_show=([^"]*['"]),href=$1$2/show/$3/$4, #<a href="http://example.com/alXbum/aXbc?twg_album=abc&twg_show=A.jpg"> #<a href="http://example.com/image/abc/A.jpg"> Substitute s,href="([^:]*)://([^/]*)/.*\?twg_album=([^&]*)&twg_show=([^"]*)",href="$1://$2/image/$3/$4", #<a href="/alXbum/aXbc?twg_album=abc&twg_show=A.jpg"> #<a href="/image/abc/A.jpg"> Substitute s,href=(["'])/[^>]*\?twg_album=([^&]*)&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] |
Author: | TinyWebGallery [ 3. Apr 2013, 09:27 ] |
Post subject: | Re: URL rewrite |
Nice - i'll give it a try. |
Author: | georgelotus [ 3. Apr 2013, 18:48 ] |
Post subject: | Re: URL rewrite |
it's far from perfect... subfolders ain't working either. new version coming in some days. |
Page 1 of 1 | All times are UTC + 1 hour [ DST ] |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |