使用.htaccess时页面重复出现问题?

时间:2018-09-01 02:25:54

标签: .htaccess

我要实现的目的是删除由于htaccess文件而来的重复文件。例如,我将我的www.xyz.com/about.php更改为www.xyz.com/about,但是这些页面被视为重复内容。我怎样才能解决这个问题。我的.htaccess代码在下面给出

Apache配置文件(请参阅httpd.apache.org/docs/2.2/mod/quickreference.html)

# disable directory listing
RewriteEngine on
RewriteBase /
Options -Indexes

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule ^(.*)$ $1.php [L]
RewriteCond %{REQUEST_FILENAME}.php !-f 
RewriteRule ^([^/.]+)/?$ inner.php [L]
RewriteCond index.php -f
Redirect 301 index.php /
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

谢谢。

0 个答案:

没有答案