Hi,
Okay, this is going to be sound a bit troublesome, so concentrate when reading this
Vano, are you reading this? Good.
I would like to start out by saying that this is an addition to the already well known:
[Mod] Search Engine Friendly URLs aka Short URLs
http://www.4homepages.de/forum/index.php?topic=6729.0
I have some additions and some questions.
First off: I've noticed that alot of people have asked for having the "name of the page/picture" in the URL. While I know this cannot be done, because of 4images working with number id's, I've thought about something else. It would be possible to edit .htaccess specifically for every category. Meaning, every category would have its own unique name. For example:
categories.php?cat_id=1 would maybe be named "Travel", so it would become
http://www.site.com/travel instead of just
http://www.site.com/cat1.htmI tried editing the htaccess file, acquired in the
http://www.4homepages.de/forum/index.php?topic=6729.0 thread by Chris, and this is what I edited. Instead of having this:
RewriteRule ^cat\.html$ categories.php?%{QUERY_STRING}
RewriteRule ^cat([0-9]+)\.([0-9]+)\.html$ categories.php?cat_id=$1&page=$2&%{QUERY_STRING}
RewriteRule ^cat([0-9]+)\.html$ categories.php?cat_id=$1&%{QUERY_STRING}
I would have:
RewriteRule ^travel\.([0-9]+)$ categories.php?cat_id=1&page=$2&%{QUERY_STRING}
RewriteRule ^travel$ categories.php?cat_id=1&%{QUERY_STRING}
RewriteRule ^flying\.([0-9]+)$ categories.php?cat_id=2&page=$2&%{QUERY_STRING}
RewriteRule ^flying$ categories.php?cat_id=2&%{QUERY_STRING}
-you get the idea... Making new lines, for each category AND changing the number of the category in the URL accordingly.
Now, I then thought of having URLs looking like this:
http://www.site.com/travel/2
Instead of:
http://www.site.com/travel?page=2
I guess this could be done (this is proven to be a better solution, SE wise, we all know that), but there's just one problem. Let's say we have the URL
http://www.site.com/travel/2 and I want to look at, say, a picture on that page. The browser would request, fx,
http://www.site.com/travel/2/img24.htm which would be an incorrect filepath.
Therefore I did some searching, and found this on webmasterworld:
http://www.webmasterworld.com/forum92/2811.htmRewriteEngine on
# not to loop
RewriteCond %{REQUEST_FILENAME} !/css_folder/
#if doesn't exist
RewriteCond %{REQUEST_FILENAME} !-f
# redirect
RewriteRule ([^/.]+)\.css$ /css_folder/$1.css [L]
This code will drop any folder path information, and keep only the name of the css file. If that's not what you want, then try
RewriteRule ^(.+)\.css$ /css_folder/$1.css [L]
-Where the answer to why doing this, was:
What's the benefit of doing this?
-If you use "virtual dirs", such as http://example.com/home/house.html and reference images/styles relative (src="css_folder/style.css"), the browser would request http://example.com/home/css_folder/style.css.
This broken path is being rewritten to the exsisting path http://example.com/css_folder/style.css.
Now, my question is, how do I edit the .htaccess and the session.php files, to be able to do this (
http://www.site.com/travel/4)
Hope it all makes sense.