i have this current url rewrite:
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?id=$1
Now i need to add, that every space is replaced with a "-", but how can i add this to my rewrite? is this possible doing it this way?
You can accept spaces in your rewrite rule:
RewriteRule ^([(a-zA-Z0-9_-]|\s)+)$ index.php?id=$1
Then in index.php you would have to replace the spaces with underscores:
preg_replace('/\s+/', '_', $id);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.