.htaccess文件是不工作的Go Daddy的服务器上 [英] .htaccess file is not working on go daddy server

查看:222
本文介绍了.htaccess文件是不工作的Go Daddy的服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个托管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]

这篇关于.htaccess文件是不工作的Go Daddy的服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆