Forum Moderators: phranque

Message Too Old, No Replies

Please, help with RewriteRule

         

lnter

2:43 pm on Sep 24, 2009 (gmt 0)

10+ Year Member



Please, help, what RewriteRule i have to write to change http://www.example.com/Ziedi/hiacintes to
http://www.example.com/cgi-bin/CGISample.exe/Ziedi?hiacintes?

(Problem: when i am clicking on http://www.example.com/cgi-bin/CGISample.exe/Ziedi?hiacintes link - it opens, but if i click on http://www.example.com/Ziedi/hiacintes - it doesnt work)

[edited by: jdMorgan at 3:21 pm (utc) on Sep. 24, 2009]
[edit reason] Please use example.com. See Terms of Service and Charter. [/edit]

jdMorgan

3:25 pm on Sep 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We can help you with your code here, but we cannot write it for you. This is a discussion forum to discuss specific problems with server configuration and code. Please see our Forum Charter for more information.

You can also use the WebmasterWorld site search to look for 'rewriterule static URL to dynamic script' and other such keyword phrases to turn up hundreds of previous threads on this subject, and check our Forum Library for selected threads as well (links are at the top of this page).

Jim

g1smd

3:32 pm on Sep 24, 2009 (gmt 0)

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



There are several very similar questions asked in the last 48 hours here if you want to check those threads for pointers and examples.

What code have you already tried? This forum exists to help you develop your own code, not write it for you. There isn't enough volunteers for that.

lnter

10:18 am on Sep 25, 2009 (gmt 0)

10+ Year Member



I have tried this one: RewriteRule ^/cgi-bin/CGISample.exe/Ziedi?hiacintes(.*)$ /Ziedi/hiacintes=$1

jdMorgan

12:49 pm on Sep 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Where is your code located? -- in .htaccess, in httpd.conf, or someplace else? (This will affect the code, and must be taken into account.)

Your rule appears to be backwards. With the above note in mind, and assuming the code goes into .htaccess, this will likely be closer to what you need:


RewriteRule ^Ziedi/hiacintes$ /cgi-bin/CGISample.exe/Ziedi?hiacintes [L]

This is a URL-to-filepath translation, that is,
RewriteRule <pattern to match requested URL-path> <physical server filepath+query> [L]

If this is the only RewriteRule you've got, then you'll need to set up and enable mod_rewrite before the rule:


Options +FollowSymLinks
RewriteEngine on

Jim

lnter

1:03 pm on Sep 25, 2009 (gmt 0)

10+ Year Member



I am writing in .htaccess.
Now my cde looks like this:

RewriteEngine On
RewriteBase /
RewriteRule ^Ziedi/hiacintes$ /cgi-bin/CGISample.exe/Ziedi?hiacintes [L]

Thanks for this answer!
But it still doesnt open www.ttii.com/Ziedi/hiacintes
Also, i would like to better understand one thing: why i cannot write like this:
RewriteRule ^(.*)/(.*)$ /cgli-bin/CGISample.exe/(.*)(.*)1$ [L] ?

jdMorgan

1:32 pm on Sep 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Because that isn't valid syntax. Have you read the mod_rewrite documentation? If not, you should... See our Forum Charter for the useful reference materials cited therein.

Get the single-page "hiacintes" rule working first, before trying to make it work with "Ziedi/<any-plant>" URLs.

[added] ... and do be sure to completely-flush (delete) your browser cache before testing any new server-side code. Otherwise, your browser will show you previously-cached 'pages' and server responses, and will not send a request to your server. Therefore, your new code can have no effect. [/added]

Jim