Forum Moderators: phranque

Message Too Old, No Replies

.httaccess Problem

Cant convert dynamic to static links

         

neominds

11:25 am on Aug 4, 2006 (gmt 0)

10+ Year Member



I have this problem with my httaccess cause i cant find the right string to convert a simple dynamic file to a static one.

I want to convert the following:
[mysite.com...]
to
[mysite.com...]

and

[mysite.com...]
to
[mysite.com...]

The whole site exist out of one file which is index.php that calls the other pages in a string, for example

index.php?view=home
index.php?view=sitemap
index.php?view=links

So there are no numbers or something. I had a rewrite rule but I dont thing it is ok:

RewriteEngine on
RewriteRule ^view/([^/\.]+)/?$ index.php?view=$1 [L]

Does anyone now how i can get it right?

Cheers

Richard
<snip>

[edited by: jdMorgan at 1:27 pm (utc) on Aug. 4, 2006]
[edit reason]
[1][edit reason] No URLs, please. See TOS. [/edit]
[/edit][/1]

jdMorgan

1:33 pm on Aug 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you want to rewrite from "webmaster.html" to view="webmaster", then your rule pattern must take into account the ".html" on the end of the requested URL:

RewriteEngine on
RewriteRule ^view/([^/.]+)\.html$ index.php?view=$1 [L]

Also, the $1 is going to 'copy' the parenthesized 'word' from the requested URL to the value of the "view=" script parameter, so you cannot change "index" to "home" unless you use a one-off special rule to do it.

See Changing Dynamic URLs to Static URLs [webmasterworld.com] in our forum library.

Jim

neominds

7:11 pm on Aug 7, 2006 (gmt 0)

10+ Year Member



It seems not t be working. It still contains the same urls...

encyclo

2:18 am on Aug 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It still contains the same urls...

When you say "It" do you mean your site?

mod_rewrite will handle the translation of the search-engine friendly URLs to the scripted equivalents, but you still have to convert your site to actually use those URLs.

neominds

4:02 am on Aug 20, 2006 (gmt 0)

10+ Year Member



I meant that nothing happend to the urls... They stay the same.