首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SocialEngine - .htaccess中的重定向

SocialEngine - .htaccess中的重定向
EN

Stack Overflow用户
提问于 2011-10-27 00:00:14
回答 1查看 2.2K关注 0票数 1

我已经在我的私人服务器上完成了SocialEngine PHP的全新安装。

我现在还需要安装Moodle,并通过以下方式访问它:

http://www.example.com/moodle

SocialEngine会创建自己的.htaccess文件,所以每次我尝试访问moodle目录时,都会得到一个"Page Not file .您试图访问的页面无法找到“的提示。因为重定向迫使它在SocialEngine插件中搜索moodle,而我希望它重定向到/httpdocs中的/moodle/目录。

我是一个非常新手与.htaccess选项,我需要一个提示,我可以做什么。

.htaccess的内容如下:

代码语言:javascript
复制
<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On

  # 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

有什么建议或建议吗?

非常感谢您的提前!

致以问候。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-10-27 01:21:07

每次重写时,我都会排除moodle文件夹,并检查它是否正常工作。在它工作后,我会在你并不真正需要它的每条规则中删除它。

代码语言:javascript
复制
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On

# Get rid of index.php
RewriteCond %{REQUEST_URI} !^/moodle
RewriteCond %{REQUEST_URI} /index\.php
RewriteRule (.*) index.php?rewrite=2 [L,QSA]

# Rewrite all directory-looking urls
RewriteCond %{REQUEST_URI} !^/moodle
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*) index.php?rewrite=1 [L,QSA]

# Try to route missing files
RewriteCond %{REQUEST_URI} !^/moodle
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_URI} !^/moodle
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
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7905417

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档