Forum Moderators: phranque

Message Too Old, No Replies

RewriteRule trailing dot dropped

         

AaZmaN

5:10 pm on Sep 29, 2008 (gmt 0)

10+ Year Member



Hi everybody!
Hope anyone had this problem and knows the solution...

I am trying to rewrite the address as follows:


RewriteRule ^([a-zA-Z.]+)/?$ index.php?req=$1 [L]

I need this to rewrite the address 'mydomain.com/some.category.' to 'index.php?var=some.category.' (with trailing '.' dot)
Everything works fine except the trailing dot is dropped. The $var variable is without dot from the end. >:(

Does anybody know why it is dropped and how to fix it?

jdMorgan

6:03 pm on Sep 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The rule is correct, and should work as you expect. However, it is likely that either your browser or the server (or both) considers the trailing dot to be illegal or spurious, and removes it.

You are not free to just 'invent' any URLs you like. There are restrictions in character-set usage and syntax with which you must comply for proper client-server interaction and optimal search ranking. See RFC2396 - Uniform Resource Identifiers (URI): Generic Syntax [faqs.org] for more information.

Jim

g1smd

8:02 pm on Sep 29, 2008 (gmt 0)

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



You don't just need a rewrite to connect your URL request to the internal dynamic filepath, you also need a redirect so that people asking for the incorrect URL are redirected to the correct URL.

The links on your pages also need to point to the new URLs.

I posted a detailed example yesterday, and again the day before, which bear detailed study to understand all the steps, and there are more examples in the reference thread pinned at the top of this forum.

AaZmaN

8:36 am on Sep 30, 2008 (gmt 0)

10+ Year Member



How would you explain this address then?:
http://www.dmoz.org/Computers/Companies/Apple_Inc./

g1smd

8:49 am on Sep 30, 2008 (gmt 0)

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



It has a / after the dot, so it doesn't have a dot as the very last character.

You cannot have a dot as the very last character.

AaZmaN

2:52 pm on Sep 30, 2008 (gmt 0)

10+ Year Member



The fact is that if I even add a slash at the end the dot before slash is dropped anyway.