【问题标题】:url rewrite to cut folder namesurl重写以剪切文件夹名称
【发布时间】:2013-07-18 00:37:49
【问题描述】:

我有一些文件夹是这样的结构

测试 > >页面 >一般(在页面内我有我的 index.php、contact.php 等)

目前我的网址看起来像这样

www.test.com/test/main/pages/general.index.php

我怎样才能重写这个,这样我就可以把所有的文件夹都删掉并显示出来

www.test.com/index.php

我已经完成了

RewriteEngine on

AuthUserFile "/home/amytesting/.htpasswds/public_html/passwd"
AuthName "root"
AuthType Basic
require valid-user
Options -Indexes

RewriteCond %{HTTP_HOST} ^test\.com [OR]
RewriteCond %{HTTP_HOST} ^www\.test\.com
RewriteRule ^/?$ "http\:\/\/test\.com/\ " [R=301,L]

【问题讨论】:

标签: .htaccess url-rewriting


【解决方案1】:

你可以试试这个简单的htaccess代码:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.test.com$
RewriteRule ^contact$ http://contactx.test.com/contactX/contact-question.cfm

【讨论】:

  • 如果我放 index.php 是否意味着我需要放所有其他文件,或者它们不是说明文件夹是否应该删除所有其他文件夹的最佳方式?跨度>
  • 我不想显示www.test.com/test/main/pages/general.index.php 我想显示www.test.com/index.php
  • 基本上一般文件夹中的任何内容都应该剪切到`www.test.com/THE FILE NAME
  • 如果您发送了网站...www.test.com 我希望它显示 index.php 页面。当您单击任何导航链接时,例如联系页面,它应该是www.test.com/conatct.php 或 www.test.com/contact`
  • 我刚刚发现了为什么我的代码不能正常工作,因为 godaddy windows plan 不支持 .htaccess
猜你喜欢
  • 2014-12-07
  • 1970-01-01
  • 1970-01-01
  • 2014-12-26
  • 2014-03-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-01-13
相关资源
最近更新 更多