Forum Moderators: phranque

Message Too Old, No Replies

.htaccess rewrite dynamic url

         

vipink

5:35 pm on Jun 25, 2006 (gmt 0)

10+ Year Member



I want to rewrite a dynamic url into static one but it didn't worked out

dynamic url: [domain.com...]

i want the static url look like :
[domain.com...]

I tried the following syntax but it didn't work:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^folder/(.*)$ folder/file.php?var1=$1 [L]

I had put this code in the .htaccess file in my root folder.

Please help me out

jdMorgan

8:30 pm on Jun 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's a post in our library [webmasterworld.com] that you may find useful.

Jim

vipink

4:41 am on Jun 26, 2006 (gmt 0)

10+ Year Member



I tried that but that didnt worked

abates

8:24 am on Jun 27, 2006 (gmt 0)

10+ Year Member



RewriteRule ^folder/(.*)$ folder/file.php?var1=$1 [L]

This line results in an infinite loop. you should add a rewrite condition to it:

RewriteCond %{REQUEST_URI}!^folder/file.php
RewriteRule ^folder/(.*)$ folder/file.php?var1=$1 [L]

That will avoid applying the rule after it has already been applied. Note that there should be a space after %{REQUEST_URI}.

You might also need leading /s before folder. IE:
RewriteRule ^/folder/(.*)$
etc.

AjiNIMC

2:33 pm on Jun 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi vipink,

Welcome to the forums,

My First question, are you getting such urls
[domain.com...] Let's break the problem into simpler halves.

If you are getting then we can think of processing it.

AjiNIMC

kunwarbs

4:30 pm on Jul 2, 2006 (gmt 0)

10+ Year Member



try using this tool

[webmaster-toolkit.com...]

vipink

4:51 pm on Jul 2, 2006 (gmt 0)

10+ Year Member



Hi AjiNIMC,

The directives are working fine if I use the following:

Options +FollowSymLinks
RewriteEngine on
RewriteRule file/(.*)/(.*)/$ /folder/file.php?$1=$2

and the new static url looks like [domain.com...]

while i need the url look like
[domain.com...]

pls help