我的本地开发计算机上有一个SocialEngine网站。我正在尝试使用与在线服务器上相同的.htaccess文件从URL中删除index.php,但是大多数URL仍显示index.php。没有出现index.php的唯一地方是访问公共目录中的文件,例如http://localhost/public/car.png
,但要打开例如必须包含一个http://localhost/index.php/restapi/music/browse
之类的API网址,index.php。
我的.htaccess
内容:
RewriteCond %{HTTP_HOST} ^example\.ir$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.ir$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^/?$ "http\:\/\/example\.com" [R=301,L]
RewriteCond %{HTTP_HOST} ^examplegood\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.examplegood\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
#RewriteRule ^/?$ "https\:\/\/example\.com\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^examplewood\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.examplewood\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^/?$ "http\:\/\/example\.com" [R=301,L]
RewriteCond %{HTTP_HOST} ^examplepic\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.examplepic\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^/?$ "http\:\/\/example\.com" [R=301,L]
# $Id: .htaccess 9977 2013-03-19 20:51:56Z john $
php_value post_max_size 2048M
php_value upload_max_filesize 2048M
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
#for redirect urls
RewriteCond %{HTTP_HOST} ^test.example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^test.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]
#RewriteCond %{HTTPS} !on
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Get rid of index.php
RewriteCond %{REQUEST_URI} /index\.php
RewriteRule (.*) index.php?rewrite=2 [L,QSA]
# Rewrite all directory-looking urls
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*) index.php?rewrite=1 [L,QSA]
# Try to route missing files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} public\/ [OR]
RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$
RewriteRule . - [L]
# If the file doesn't exist, rewrite to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA]
</IfModule>
# sends requests /index.php/path/to/module/ to "index.php"
# AcceptPathInfo On
# @todo This may not be effective in some cases
FileETag Size
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>