Forum Moderators: phranque

Message Too Old, No Replies

rewrite with server api as cgi

trying to rewrite using htaccess to correct server api as cgi issues

         

t2dman

3:21 pm on Jul 27, 2005 (gmt 0)

10+ Year Member



Im having some problems with some htaccess scripting. Any ideas?
Server API as CGI rather than Apache.

RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^archive/index.php/index.php$ [domain.com...] [R=301,L]

The above code redirects a bad url of:
[domain.com...]

to the incorrect:
[domain.com...]

I need to get rid of the string at the end - any ideas how to achieve:
[domain.com...]

Unfortunately I cant correct the double index.php url at the moment, so trying to get a workaround with the htaccess.

jdMorgan

3:35 pm on Jul 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Add a question mark at the end of the substitution URL to clear the existing query string:

RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^archive/index.php/index.php$ http://example.com/archive/index.ph[b]p/%1?[/b] [R=301,L]

Jim

t2dman

3:53 pm on Jul 27, 2005 (gmt 0)

10+ Year Member



Works a dream. Thanks.
Now a follow on. I added the domain at the start to get rid of the information that it added at the start. What character would I add instead of adding the domain to achieve the same effect?

jdMorgan

9:16 pm on Jul 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry, can you re-phrase that question? It's not clear to me... ;(

Maybe it's this: If you want to use an internal rewrite as opposed to an external redirect, the rule would be:


RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^archive/index.php/index.php$ /archive/index.php/%1? [L]

Jim