使用htaccess可以使用不同类型的URL

I have two types of urls I want to make readable/pretty:

www.mydomain.com/index.php -> www.mydomain.com/index 
(remove .php)

And

www.mydomain.com/information.php?=story1 -> www.mydomain.com/information/story1
(replace .php=? with /)
Im using $_SERVER[REQUEST_URI] to grab the "story" from the database

I've tried for days and hours, but can't find any solutions. Any suggestions?

You should try this:

RewriteEngine On

# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://example.com/folder/$1 [R=301,L]

# Redirect external .php requests to extensionless url
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ http://example.com/folder/$1 [R=301,L]

# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]

Okay, I figured it out myself.

First: www.mydomain.com/index.php -> www.mydomain.com/index (remove .php)

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

Second: I had to make a few changes, but heres goes:

Goal: www.mydomain.com/information.php?story=1 -> www.mydomain.com/information/1

RewriteEngine on
RewriteRule ^information/([A-Za-z0-9-\s]+)$ information.php?story=$1

And this is added to the php code:

$story_str = $_GET['story'];
$story_str = 1

In the tag of your php code, add this to make sure your images and CSS is loaded:

<base href="/" />

And finally, add this to your .htaccess also to make sure your images and CSS is loaded:

RewriteRule ^detail/(css|js|img)/(.*)?$ /$1/$2 [L,QSA,R=301]