.htaccess 使用htaccess时,所有内部链接都会更改

.htaccess 使用htaccess时,所有内部链接都会更改,.htaccess,.htaccess,我想将我的网站URL示例www.mysite.com/about.php更改为www.mysite.com/about/ 我在htaccess文件中使用此代码 # Apache Rewrite Rules <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase / # Add trailing slash to url RewriteCond %{REQUEST_FILENA

我想将我的网站URL示例www.mysite.com/about.php更改为www.mysite.com/about/

我在htaccess文件中使用此代码

# Apache Rewrite Rules
<IfModule mod_rewrite.c>
 Options +FollowSymLinks
 RewriteEngine On
 RewriteBase /

# Add trailing slash to url
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
 RewriteRule ^(.*)$ $1/ [R=301,L]

# Remove .php-extension from url
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}\.php -f
  RewriteRule ^([^\.]+)/$ $1.php 

# End of Apache Rewrite Rules
</IfModule>
它可以工作,但是所有的页面内容都在/about/its中,就像我创建了一个不存在的文件夹,所以所有的内部链接都会被更改,如果我有一个到post.php的链接,它就会转到/about/post.php

所有包含的页面都无法正常工作,例如css和图像


对不起,我的英语不太好。

我终于找到了我想要的,我在标题部分使用了这个元标记

`<base href="http://localhost/mysite/" />`
``
现在一切都好了

注意:不要在webhost上使用localehost

`<base href="http://localhost/mysite/" />`