Forum Moderators: phranque

Message Too Old, No Replies

another rewrite url question

         

ayok

8:58 am on Sep 13, 2008 (gmt 0)

10+ Year Member



Hi,

I'm a newbie for working with apache and .htaccess file. I've seen the tutorial on this thread [webmasterworld.com]. My code now is:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
#
RewriteRule ^category/product/([0-9]+)/?$ catprod.php?cat=$1[L]
#
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /catprod\.php\?cat=([^&]+)\ HTTP/
RewriteRule ^catprod\.php$ http://www.example.com/store/category/product/%1? [R=301,L]

and I upload this on /store/ direction.

However, i don't see any change on my url bar on the browser.

Could someone point me where i do wrong?

Thank you,
ayok

[edited by: jdMorgan at 7:35 pm (utc) on Sep. 13, 2008]
[edit reason] changed to example.com and fixed [ code ] tags [/edit]

g1smd

1:24 pm on Sep 13, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



URLs are defined by the links that people click on. Make sure the links on the page are in the format that you want people and bots to see.

A rewrite connects that URL to the internal filepath on the server.

.

What do you want people to see as the URL?

What is the location on the server (the filepath) where the content really is?

.

You have a redirect there and a rewrite.

The redirect (the stuff with [R=301,L] on) needs to be first.

The rewrite (the stuff with [L] on) needs to be last.

As you have it now, you could expose internal paths out into the URL by redirecting after the rewrite has occurred.

.

RewriteBase / - is the default. You likely can omit that line.

ayok

2:01 pm on Sep 13, 2008 (gmt 0)

10+ Year Member



Hi g1smd,
Thanks for your reaction.
I want the people see the url catprod.php?cat=234 into category/product/234.

I guess in I don't need redirect on this case. Should I delete the [R]? However, I still got no result with or without it.

FYI, I have no authorization to change anything on php.ini. Do I need to do something there? Once again, I am new for this stuff.

Thanks,
ayok

g1smd

2:59 pm on Sep 13, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



*** I want the people see the url catprod.php?cat=234 into category/product/234. ***

Sorry. That wording is still ambiguous to me.

You need to spell it out.

The URL in the links on the page is...
The URL I want the user to see is...
The file is located on the server at...

ayok

3:11 pm on Sep 13, 2008 (gmt 0)

10+ Year Member



The URL in the links on the page is www.example.com/store/catprod.php?cat=234
The URL I want the user to see is www.example.com/store/category/product/234
The file is located on the server at www.example.com/store/

Thank you,
ayok

[edited by: jdMorgan at 7:36 pm (utc) on Sep. 13, 2008]
[edit reason] Please use example.com only [/edit]