0

I was asked to help a friend to rewrite urls for a site he has a client.

The link structure looks like this:

<a href="http://sitename.dk/index.php?page=wisetrap">WiseTrap</a>
// URL: sitename.dk/index.php?page=wisetrap

Is it possible to keep the link structure like that, but after the link is clicked make it appear in the url like this:

// URL: sitename.dk/wisetrap

Any htaccess brains out there?

I know I have to deal with some variables in the htaccess file, but I havent been able to make it work.

So basicaly strip the filename: index.php and then add the 1.st $_GET variable to the end..

/Klemme

Edited by klemme

3
Contributors
5
Replies
6
Views
4 Years
Discussion Span
Last Post by diafol
0

Thanks for your answer!

It gave me this url:

// I created a test page, and have links like this:

<a href="index.php?page=grise">grise</a>
<a href="index.php?page=hunde">hunde</a>
<a href="index.php?page=fugle">fugle</a>
<a href="index.php?page=heste">heste</a>
<a href="index.php?page=slanger">slanger</a>

// I adde this to the htaccess file:
RewriteRule (.*) http://www.sitename.dk/index.php?page=$1 [QSA,L]

// And got this url:
http://www.sitename.dk/index.php?page=index.php

// And im after:
http://www.sitename.dk/grise 

Any idea?

0

Hmm, that didnt do anything at all, guess im doing something wrong..

Could I do this, and not use any domain name in the rewrite:

RewriteRule ^index\.php?page=(.*) index\.php/$1 [R=301,QSA,L]

That is also not doing anything, but you get the idea?

0
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]*)/*$ index.php?page=$1 [L]

Just a rewrite not a redirect. So for that your links would have to be in the rewritten format too.

<a href="/slanger/">slanger</a>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.