由网友(我看你能和她猖狂多久-)分享简介:我有一个托管Godaddy的服务器上的网站。对于SEO我已做了所有不受PHP扩展的规则。对于URL重写我使用的.htaccess 文件的.htaccess 文件运行良好的本地服务器上的XAMPP,但活的服务器(GoDaddy的服务器)上就不能正常工作。 我不知道关于的.htaccess 文件code 的.htacces...
我有一个托管Godaddy的服务器上的网站。对于SEO我已做了所有不受PHP扩展的规则。对于URL重写我使用的.htaccess
文件
的.htaccess
文件运行良好的本地服务器上的XAMPP,但活的服务器(GoDaddy的服务器)上就不能正常工作。
我不知道关于的.htaccess
文件code
的.htaccess
文件内容
RewriteEngine叙述上
选项+多视图
解决方案
我已经找到答案自己
选项+了FollowSymLinks -MultiViews
#开启mod_rewrite的上
RewriteEngine叙述上
的RewriteBase /
##隐藏PHP扩展
#要外部重定向/dir/foo.php到/ DIR /富
的RewriteCond%{THE_REQUEST} ^ [AZ] {3,} S([^。] +)。PHP [NC]
重写规则^%1 [R,L,NC]
##在内部重定向/ DIR /富到/dir/foo.php
的RewriteCond%{} REQUEST_FILENAME -f .PHP
重写规则^%{REQUEST_URI}的.php [L]
I have a website that is hosted on Godaddy server. For SEO I have made all the rule free from .php extension. for url rewrite i am using .htaccess
file
.htaccess
file is running fine on local server that is XAMPP, but on live server (godaddy server ) it is not working.
I have no idea about .htaccess
file code
.htaccess
file content is
RewriteEngine On
Options +MultiViews
解决方案
i have found answer myself
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
## hide .php extension
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s([^.]+).php [NC]
RewriteRule ^ %1 [R,L,NC]
## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
相关推荐
最新文章