Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite little question.

         

Dragosh

6:42 pm on Nov 24, 2007 (gmt 0)

10+ Year Member



This is the content of my .htaccess file:

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^(.*)-(.*).html$ ./index.php?pagenum=$2&category=$1 [L]

The thing that surprises me most is that this htaccess does the same thing that was written in a tutorial,but uses much less code. With this htaccess i can access for example www.something.com/cat-3.html,get page from the original www.something.com/?animal=cat&id=3 and at the same time have in my browsers adress bar www.something.com/cat-3.html.
I am wondering if this is happening for an unknown reason only on my computer, because i want to know if i can use this on my website. I dont want to lose some search bots or visitors,thats why i am asking if this method can be used online.
Thanks in advance, Dragos

jdMorgan

4:15 am on Nov 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This method is used on almost the entire WebmasterWorld site. :)

Jim

Dragosh

7:34 am on Nov 25, 2007 (gmt 0)

10+ Year Member



Haha, cool.. Then may i ask you why your tutorial was so long? And which is better to use?

jdMorgan

2:00 pm on Nov 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure you may ask why my tutorial was so long, but I'd need to know which of the many tutorials I've written you are referring to before I can answer your questions. :)

Jim

Dragosh

7:54 pm on Nov 25, 2007 (gmt 0)

10+ Year Member



This tutorial [webmasterworld.com...] .

But i have just tried this on my online website and unfortunately did not work. Are you sure this little piece of code is working for you?

Edited after i figured out where my mistake was : It's working! I never knew that in apache language ./index.php is different from /index.php .

[edited by: Dragosh at 8:19 pm (utc) on Nov. 25, 2007]

jdMorgan

10:05 pm on Nov 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ah, that post is long because it complies with Einstein's famous dictum, "Make everything as simple as possible, but no simpler."

The details I included were meant to explain the process clearly and minimize the number of questions that might arise when people read it. Since as a volunteer, I have only limited amount of time to post here, it seemed best to try to answer the most-likely questions ahead of time in the post itself.

And to answer your other question, yes, most of the code I post here comes off a live server and is known to work in my server environment -- but maybe not yours.

Jim