简体   繁体   中英

How to randomize url with htaccess

url : http://localhost/dashboard/ {random_string}/index.php

.htaccess file

RewriteEngine on
# Options +FollowSymlinks
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L]
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^[A-Za-z0-9]{4}/(.*?)$ /dashboard/$1 [L,DPI]

but it still 404NF, can u help me?

I assume you want http://localhost/dashboard/{random_string}/index.php to be be processed as http://localhost/dashboard/index.php?id={random_string}

RewriteEngine on
RewriteBase "/"
RewriteRule "^dashboard/([^/]+)/index.php$" "dashboard/index.php?id=$1" [L]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM