friendly urls in subdomain don't work

Discuss practical ways rearrange URLs using mod_rewrite.

friendly urls in subdomain don't work

Postby BMN » Wed Mar 03, 2010 11:09 am

I've got a photogallery, with links containing 2 to 4 variables.
gallery is placed in a subdomain
I'll use symbolic names
dynamic links:
to certain album: /index.php?album=30&sort=1 (boldened value is dynamic)
to certain photo in certain album: /index.php?album=30&detail=533&offset=&order=0&sort=1 (&offset=&order=0&sort=1 don't change)

What I'd like to achieve:
albums: (/album/ is an added string before album number, not a directory, nor a value in existing links)
photos: ... oto_number

I've concentrated on creating friendly urls for albums firstly, but after spending 5 hours any RewriteCond I'd come up with don't want to work.
My hits to at least make it working:
RewriteRule ^album/(.*)/(.*)$ index.php?album=$1&sort=$2 [QSA,L]
RewriteRule ^album/([0-9]+)/([0-9]+)/?$ /index.php?album=$1&sort=$2 [QSA,L]
RewriteRule ^album/([^/]+)/([^/]+)/?$ /index.php?album=$1&sort=$2 [L]

All above are just some variations. I tried with [L] (w/o qsa directive), /index.php\?album (as I've found somewhere that base link has to be written using php\? instead of php?) with /?$ and without (just "...+)" at the end) etc.
None of those worked, while (.*) should catch everything, not just numbers as ([0-9]+) does.

I've tried using query string as well:
RewriteCond %{QUERY_STRING} ^(.*)album=30&sort=1$ [NC]
RewriteRule ^album/(.*)/(.*)$ index.php\?album=$1&sort=$2 [QSA,L]

I thought rewriting a dynamic link in the most simple way is ... simple. But this problem surpassed me completely.
I don't even know how to hide part of the link (which is for example &sort=1)

What am I doing wrong, can somebody point me to the right direction ? :(

ps. how can I log mod rewrite's errors ?
RewriteLog modrewrite.log (even with full path to the file on the server /home/myusername/domains/")
RewriteLogLevel 3
leads to a 500 server error :|
Posts: 39
Joined: Wed Jul 05, 2006 2:15 am

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 7 guests