Frnak
Frnak

Reputation: 6792

htaccess rewrite only working with numbers

I want to rewrite different url's in this way:

myPage.de/static/about => myPage.de/index.php?st=about

The same for some other catagories like static.

I created this htaccess file:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^static/(\d+)*$ ./index.php?st=$1
RewriteRule ^content/(\d+)*$ ./index.php?cl=$1

This seems to work whenever i try something like: myPage.de/static/123 (123 is then given as parmeter) when i do something like myPage.de/static/test I always receive an object not found error in my browser.

Upvotes: 0

Views: 81

Answers (1)

arco444
arco444

Reputation: 22821

(\d+) means one or more digits. Change it to (.*) if you want it to match everything. The * before $ can also be removed.

RewriteRule ^static/(.*)$ /index.php?st=$1
RewriteRule ^content/(.*)$ /index.php?cl=$1

Upvotes: 1

Related Questions