如何使用.htaccess隐藏网址中的多个目录?

时间:2014-10-23 06:21:17

标签: php .htaccess mod-rewrite

嗨,有人可以帮助我,我只是php的初学者,我有一个朋友为我写的这个CMS,但不幸的是他去世了,我不知道他到底做了什么.htaccess,我想要的是隐藏网址目录,也取出下划线并用连字符替换它,我的网址如下:

http://www.mywebsite.co.za/page/view/about_us - 这是一个普通的页面

我希望它看起来像这样:

http://www.mywebsite.co.za/about-us

我也有类似的类别:

/ PRODUCT_CATEGORY /视图/产品

我希望它看起来像这样:

/产品

这里是.htaccess:

# FollowSymLinks conflicts with mod_fcgid:
## Options +FollowSymLinks
RewriteEngine on

#Exclude all the necessary files/folders
RewriteRule ^blu/ckeditor/.*$ - [PT]
RewriteRule ^blu/ckfinder/.*$ - [PT]
RewriteRule ^blu/templates/.*$ - [PT]
RewriteRule ^blu/styles/.*$ - [PT]
RewriteRule ^blu/javascript/.*$ - [PT]
RewriteRule ^blu/images/.*$ - [PT]
RewriteRule ^blu/temp.php$ - [PT]
RewriteRule ^blu/update_browser.php$ - [PT]
RewriteRule ^blu/create_image.php$ - [PT]
RewriteRule ^blu/upload_image.php$ - [PT]
RewriteRule ^blu/upload_image.php$ - [PT]
RewriteRule ^blu/favicon.ico$ - [PT]
RewriteRule ^blu/url_not_allowed.php$ - [PT]
RewriteRule ^blu/ajax/.*$ - [PT]
RewriteRule ^blu/modules/(.*)/(.*)/include/.*$ - [PT]

RewriteRule ^blu/$  blu/index.php [L,QSA]

#The following rule is where objects get viewed/updated.
RewriteRule ^blu/([a-z0-9_]+)/([a-z0-9_]+)/([a-z0-9_-]+)$        blu/index.php?module=$1&action=$2&url=$3 [L,QSA]

#The following rule is used where objects get created
RewriteRule ^blu/([a-z0-9_]+)/([a-z0-9_]+)$             blu/index.php?module=$1&action=$2 [L,QSA]

#The following rule is the 'do' page for when objects get created or updated.
RewriteRule ^blu/([a-z0-9_]+)$                  blu/index.php?module=$1 [L,QSA]


#The following rule is where objects get viewed/updated.
RewriteRule ^([a-z0-9_]+)/([a-z0-9_]+)/([a-z0-9_-]+)$        index.php?module=$1&action=$2&url=$3 [L,QSA]

#The following rule is used where objects get created
RewriteRule ^([a-z0-9_]+)/([a-z0-9_]+)$             index.php?module=$1&action=$2 [L,QSA]

#The following rule is the 'do' page for when objects get created or updated.
#RewriteRule ^([a-z0-9_]+)$                  index.php?module=$1 [L,QSA]

#The following rule catches any uppercase letters in the url. (Not allowed).
RewriteRule ^([a-zA-Z0-9_/]+)$                          blu/url_not_allowed.php

# turn on the module for this directory
ExpiresActive on
# set default
ExpiresDefault "access plus 24 hours"
ExpiresByType image/jpg "access plus 1 months"
ExpiresByType image/gif "access plus 1 months"
ExpiresByType image/jpeg "access plus 1 months"
ExpiresByType image/png "access plus 1 months"
ExpiresByType image/vnd.microsoft.icon "access plus 1 months"
ExpiresByType image/x-icon "access plus 1 months"
ExpiresByType text/css "access plus 1 months"
ExpiresByType text/javascript "access plus 1 months"
ExpiresByType application/javascript "access plus 1 months"
ExpiresByType application/x-javascript "access plus 1 months"
ExpiresByType application/x-shockwave-flash "access plus 1 months"

FileETag none

<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>

0 个答案:

没有答案