These examples are how the URLs show on web browsers:
index.php?page=list-image&album=1 (The URL of "album 1" while I name the album "Tropical Islands") and index.php?page=list-image&album=2 (The URL of "album 2 while the name might be something like " Exotic Beaches" or "Beaches").
How can I rewrite the above-mentioned "album 1" URL to be: "Tropical_Islands/" and subsequent dynamically-generated albums to appear that way.
This is an example of how the image URLs show:
index.php?page=image-detail&album=1&image=1 (The URL of "image 1" of "album 1" while I name this image "Buddha Temple")
I want the image URLs to be in this form: "Tropical_Islands/Buddha_Temple/"
Can anyone please show me how to rewrite the album and image URLs in order to have search engine-friendly URLs. I have tried a few tricks I know, but nothing works. My inability to achieve this stemmed from my lack of knowledge. What I need is to tell me the exact lines to remove and giving me the code to replace them.
These are the two codes I've tried that didn't work:
- Code: Select all
## mod_rewrite configuration
Options +FollowSymLinks
# Turn on the rewriting engine
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpg|png)$ - [F]
RewriteRule ^[a-zA-Z]$ index.php?page=list-image&album=$0
RewriteRule ^([a-zA-Z])\/$ /$1 [R]
RewriteRule ^([A-Z]+)([a-z)]+)([0-9)]+)\.html$ index.php?page=image-detail&album=1&image=$3
RewriteRule ^([^/]+)/$ index.php?page=image-detail&album=1&image=$1
#Options -Indexes IncludesNOEXEC FollowSymLinks
- Code: Select all
## mod_rewrite configuration
Options +FollowSymLinks
# Turn on the rewriting engine
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpg|png)$ - [F]
RewriteRule ^([a-zA-Z0-9_])(.html)?$ index.php?page=list-image&album=$1
RewriteRule ^([a-zA-Z0-9_])\/([a-zA-Z0-9_])(.html)?$ index.php?page=image-detail&album=$1&image=$2
#Options -Indexes IncludesNOEXEC FollowSymLinks
Which of the two files above looks better, so that I can concentrate on it and discard the other? Your help will be much appreciated.