Domanda

I am having trouble with .htaccess file, essentially I am just trying to rewrite the urls to be a bit more user friendly. So what I have for a url currently is something like this:

http://diverseevolution.com/index.php?url=about

What I want is something like this:

http://diverseevolution.com/about/

Finally I have written my own .htaccess file that looks like this:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

Now I have tested this in other directories of my server and it works fine but under an actual domain and not just a sub directory it gives me a Internal Server Error 500

Any help with this would be greatly appreciated!

È stato utile?

Soluzione

You may try this:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI}  ([^/]+)/?   [NC]
RewriteRule .*  index.php?url=%1     [L,QSA]

It will map silently:

http://diverseevolution.com/anything/

To:

http://diverseevolution.com/index.php?url=anything

Altri suggerimenti

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^((about)([^?]*)) index.php?url=about [L,NC]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top