apache:
<IfModule mod_rewrite.c> Options +FollowSymLinks IndexIgnore */* RewriteEngine on # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward it to index.php RewriteRule . index.php </IfModule>
nginx:
location / { try_files $uri $uri/ /index.php?$args; } location ~ [^/]\.php(/|$) { # comment try_files $uri =404; to enable pathinfo try_files $uri =404; #fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_pass 192.168.41.249:9000; fastcgi_index index.php; include fastcgi.conf; #include pathinfo.conf; } location ~ /(\.svn|\.git|\.ht|\.DS) { deny all; internal; } location ~ /(protected|framework|nbproject|themes/\w+/views|index-test\.php) { deny all; # for production internal; log_not_found off; access_log off; } location ~* \.(js|css|png|jpg|jpeg|gif|ico|bmp|swf)$ { expires 30d; log_not_found off; } location ~ .*\.(js|css)?$ { expires 12h; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; }
时间: 2024-10-22 14:08:45