简体   繁体   中英

.htaccess file working, but not rewriting url

The time has come to hide the get variables, but my .htaccess file wont allow the rewrite.I currently have this:

RewriteEngine On
RewriteRule ^timeline/(\d.*) timeline.php?user=$1

It is timeline.php?user=chris and it must read timeline.php

I have looked for close to 2 hours, copying and changing code, but nothing works.

I have also changed

<Directory ..>
...
AllowOverride None
...
</Directory>

to:

AllowOverride All

Please help!

Use following htaccess and try

RewriteEngine On
RewriteRule ^timeline/([^/]*)$ /timeline.php?user=$1 [L]

尝试这个:

RewriteRule ^timeline/(.*)$ timeline.php?user=$1

I believe you need to turn off MultiViews option by putting line on top of your .htaccess:

Options -MultiViews
  • Option MultiViews is used by Apache's content negotiation module that runs before mod_rewrite and and makes Apache server match extensions of files. So /file can be in URL but it will serve /file.php .

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