所以这是我的.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
现在,domain.com/About正在调用文件About.php,就像domain.com/portfolio与portfolio.php一样。
问题 - domain.com/Portfolio不能与Potfolio.php一起使用,错误:
/Portfolio/.php was not found on this server.
我不知道为什么只用这个特定的词来做这件事,它已经让人头痛。有什么想法吗?
PS。没有投资组合文件夹
更新:error.log
[Fri Jul 10 12:26:46.304340 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] add path info postfix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio -> C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/
[Fri Jul 10 12:26:46.304340 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] strip per-dir prefix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/ -> Portfolio/
[Fri Jul 10 12:26:46.304340 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] applying pattern '^([^\\.]+)$' to uri 'Portfolio/'
[Fri Jul 10 12:26:46.304340 2015] [rewrite:trace4] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] RewriteCond: input='C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio' pattern='!-f' => matched
[Fri Jul 10 12:26:46.304340 2015] [rewrite:trace2] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] rewrite 'Portfolio/' -> 'Portfolio/.php'
[Fri Jul 10 12:26:46.304340 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] add per-dir prefix: Portfolio/.php -> C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php
[Fri Jul 10 12:26:46.304340 2015] [rewrite:trace2] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] strip document_root prefix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php -> /New_Era/new_era_V20/betaV2/Portfolio/.php
[Fri Jul 10 12:26:46.304340 2015] [rewrite:trace1] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] internal redirect with /New_Era/new_era_V20/betaV2/Portfolio/.php [INTERNAL REDIRECT]
[Fri Jul 10 12:26:46.304340 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff8b68/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] add path info postfix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio -> C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php
[Fri Jul 10 12:26:46.304340 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff8b68/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] strip per-dir prefix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php -> Portfolio/.php
[Fri Jul 10 12:26:46.304340 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff8b68/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] applying pattern '^([^\\.]+)$' to uri 'Portfolio/.php'
[Fri Jul 10 12:26:46.304340 2015] [rewrite:trace1] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff8b68/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] pass through C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio
[Fri Jul 10 12:26:46.304340 2015] [:error] [pid 4924:tid 1660] [client ::1:50145] script 'C:/xampp/htdocs/notfound.php' not found or unable to stat
[Fri Jul 10 12:26:47.911142 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] add path info postfix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio -> C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/
[Fri Jul 10 12:26:47.911142 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] strip per-dir prefix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/ -> Portfolio/
[Fri Jul 10 12:26:47.911142 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] applying pattern '^([^\\.]+)$' to uri 'Portfolio/'
[Fri Jul 10 12:26:47.911142 2015] [rewrite:trace4] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] RewriteCond: input='C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio' pattern='!-f' => matched
[Fri Jul 10 12:26:47.911142 2015] [rewrite:trace2] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] rewrite 'Portfolio/' -> 'Portfolio/.php'
[Fri Jul 10 12:26:47.911142 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] add per-dir prefix: Portfolio/.php -> C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php
[Fri Jul 10 12:26:47.911142 2015] [rewrite:trace2] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] strip document_root prefix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php -> /New_Era/new_era_V20/betaV2/Portfolio/.php
[Fri Jul 10 12:26:47.911142 2015] [rewrite:trace1] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] internal redirect with /New_Era/new_era_V20/betaV2/Portfolio/.php [INTERNAL REDIRECT]
[Fri Jul 10 12:26:47.911142 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2b50/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] add path info postfix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio -> C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php
[Fri Jul 10 12:26:47.911142 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2b50/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] strip per-dir prefix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php -> Portfolio/.php
[Fri Jul 10 12:26:47.911142 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2b50/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] applying pattern '^([^\\.]+)$' to uri 'Portfolio/.php'
[Fri Jul 10 12:26:47.911142 2015] [rewrite:trace1] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2b50/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] pass through C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio
[Fri Jul 10 12:26:47.911142 2015] [:error] [pid 4924:tid 1660] [client ::1:50145] script 'C:/xampp/htdocs/notfound.php' not found or unable to stat
[Fri Jul 10 12:26:48.051543 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] add path info postfix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio -> C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/
[Fri Jul 10 12:26:48.051543 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] strip per-dir prefix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/ -> Portfolio/
[Fri Jul 10 12:26:48.051543 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] applying pattern '^([^\\.]+)$' to uri 'Portfolio/'
[Fri Jul 10 12:26:48.051543 2015] [rewrite:trace4] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] RewriteCond: input='C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio' pattern='!-f' => matched
[Fri Jul 10 12:26:48.051543 2015] [rewrite:trace2] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] rewrite 'Portfolio/' -> 'Portfolio/.php'
[Fri Jul 10 12:26:48.051543 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] add per-dir prefix: Portfolio/.php -> C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php
[Fri Jul 10 12:26:48.051543 2015] [rewrite:trace2] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] strip document_root prefix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php -> /New_Era/new_era_V20/betaV2/Portfolio/.php
[Fri Jul 10 12:26:48.051543 2015] [rewrite:trace1] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2a50/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] internal redirect with /New_Era/new_era_V20/betaV2/Portfolio/.php [INTERNAL REDIRECT]
[Fri Jul 10 12:26:48.067143 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffab70/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] add path info postfix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio -> C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php
[Fri Jul 10 12:26:48.067143 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffab70/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] strip per-dir prefix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php -> Portfolio/.php
[Fri Jul 10 12:26:48.067143 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffab70/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] applying pattern '^([^\\.]+)$' to uri 'Portfolio/.php'
[Fri Jul 10 12:26:48.067143 2015] [rewrite:trace1] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffab70/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] pass through C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio
[Fri Jul 10 12:26:48.067143 2015] [:error] [pid 4924:tid 1660] [client ::1:50145] script 'C:/xampp/htdocs/notfound.php' not found or unable to stat
[Fri Jul 10 12:26:48.207543 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] add path info postfix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio -> C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/
[Fri Jul 10 12:26:48.207543 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] strip per-dir prefix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/ -> Portfolio/
[Fri Jul 10 12:26:48.207543 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] applying pattern '^([^\\.]+)$' to uri 'Portfolio/'
[Fri Jul 10 12:26:48.207543 2015] [rewrite:trace4] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] RewriteCond: input='C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio' pattern='!-f' => matched
[Fri Jul 10 12:26:48.207543 2015] [rewrite:trace2] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] rewrite 'Portfolio/' -> 'Portfolio/.php'
[Fri Jul 10 12:26:48.207543 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] add per-dir prefix: Portfolio/.php -> C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php
[Fri Jul 10 12:26:48.207543 2015] [rewrite:trace2] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] strip document_root prefix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php -> /New_Era/new_era_V20/betaV2/Portfolio/.php
[Fri Jul 10 12:26:48.207543 2015] [rewrite:trace1] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ffaa70/initial] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] internal redirect with /New_Era/new_era_V20/betaV2/Portfolio/.php [INTERNAL REDIRECT]
[Fri Jul 10 12:26:48.207543 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2b50/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] add path info postfix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio -> C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php
[Fri Jul 10 12:26:48.207543 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2b50/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] strip per-dir prefix: C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio/.php -> Portfolio/.php
[Fri Jul 10 12:26:48.207543 2015] [rewrite:trace3] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2b50/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] applying pattern '^([^\\.]+)$' to uri 'Portfolio/.php'
[Fri Jul 10 12:26:48.207543 2015] [rewrite:trace1] [pid 4924:tid 1660] mod_rewrite.c(475): [client ::1:50145] ::1 - - [localhost/sid#434100][rid#2ff2b50/initial/redir#1] [perdir C:/xampp/htdocs/New_Era/new_era_V20/betaV2/] pass through C:/xampp/htdocs/New_Era/new_era_V20/betaV2/Portfolio
[Fri Jul 10 12:26:48.223143 2015] [:error] [pid 4924:tid 1660] [client ::1:50145] script 'C:/xampp/htdocs/notfound.php' not found or unable to stat
[Fri Jul 10 12:26:56.413157 2015] [ssl:warn] [pid 5620:tid 260] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 10 12:26:56.459957 2015] [core:warn] [pid 5620:tid 260] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Jul 10 12:26:56.647158 2015] [ssl:warn] [pid 5620:tid 260] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 10 12:26:56.693958 2015] [mpm_winnt:notice] [pid 5620:tid 260] AH00455: Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.19 configured -- resuming normal operations
[Fri Jul 10 12:26:56.693958 2015] [mpm_winnt:notice] [pid 5620:tid 260] AH00456: Apache Lounge VC11 Server built: Jul 17 2014 11:50:08
[Fri Jul 10 12:26:56.693958 2015] [core:notice] [pid 5620:tid 260] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Jul 10 12:26:56.693958 2015] [mpm_winnt:notice] [pid 5620:tid 260] AH00418: Parent: Created child process 5088
[Fri Jul 10 12:26:57.458359 2015] [ssl:warn] [pid 5088:tid 272] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 10 12:26:57.692360 2015] [ssl:warn] [pid 5088:tid 272] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 10 12:26:57.739160 2015] [mpm_winnt:notice] [pid 5088:tid 272] AH00354: Child: Starting 150 worker threads.
答案 0 :(得分:1)
尝试在rewriteRule之前添加:
DirectorySlash Off