I have a script thanks to Howlin that will rewrite my url, however, I cannot access any other page then, it just gives a 404 error?
The rewrite rewrites localhost/docci.me/profile.php?user=person
to localhost/docci.me/person
and it works, but as soon as I try to load logout.php
, index.php
, or any other page, it gives a 404. If I take the .htaccess code out, it works fine but obviously does not rewrite the URL like I need it to.
here is the code:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /docci.me/login/profile\.php\?user=(.*)\ HTTP
RewriteRule ^ /docci.me/login/%2\? [R=301,L]
RewriteCond %{QUERY_STRING} !user=
RewriteRule ^(.*)$ /docci.me/login/profile.php?user=$1 [L]
Place this in /docci.me/.htaccess
:
RewriteEngine On
RewriteBase /docci.me/
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} /login/profile\.php\?user=([^&\s]+) [NC]
RewriteRule ^ login/%2? [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^./]+)/?$ login/profile.php?user=$1 [L,QSA]
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.