簡體   English   中英

在Apache 2.2 centos 6.5中進行Mod Rewrite

[英]Mod Rewrite in apache 2.2 centos 6.5

我正在嘗試在htaccess中寫入友好的seo url(重寫規則),但出現錯誤。

當我檢查mod_rewrite安裝為靜態。 請在下面檢查

core_module (static)
 authn_file_module (static)
 authn_default_module (static)
 authz_host_module (static)
 authz_groupfile_module (static)
 authz_user_module (static)
 authz_default_module (static)
 auth_basic_module (static)
 include_module (static)
 filter_module (static)
 deflate_module (static)
 log_config_module (static)
 logio_module (static)
 env_module (static)
 expires_module (static)
 headers_module (static)
 unique_id_module (static)
 setenvif_module (static)
 version_module (static)
 proxy_module (static)
 proxy_connect_module (static)
 proxy_ftp_module (static)
 proxy_http_module (static)
 proxy_scgi_module (static)
 proxy_ajp_module (static)
 proxy_balancer_module (static)
 ssl_module (static)
 mpm_prefork_module (static)
 http_module (static)
 mime_module (static)
 status_module (static)
 autoindex_module (static)
 asis_module (static)
 info_module (static)
 suexec_module (static)
 cgi_module (static)
 negotiation_module (static)
 dir_module (static)
 actions_module (static)
 userdir_module (static)
 alias_module (static)
 rewrite_module (static)
 so_module (static)
 bwlimited_module (shared)
 suphp_module (shared)
 security2_module (shared)
 pagespeed_module (shared)

以下是我的htaccess代碼

   <IfModule mod_rewrite.c>
RewriteEngine On
DirectoryIndex /raaga/splash/index.php

#REWRITE RULES
#---------------------

#RULE RAAGA_REGISTER 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/images/
RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png)$ [NC]
RewriteRule ^register /raaga/register.php [L]


ErrorDocument 404 /raaga/oops_404.php
ErrorDocument 500 /raaga/oops_500.php
</IfModule>

AddType application/octet-stream ts
AddType application/x-web-app-manifest+json webapp

請幫我什么錯。 上面的代碼在該文件夾中的另一台服務器上工作,我們在public_html本身中有項目,但是這里是public_html / raaga,所以我添加了/raaga/register.php而不是/register.php

服務器,

我認為htaccess中不會出現錯誤,它將是httpd.conf,我必須在httpd.conf文件中進行更改

謝謝

塔尼蓋維蘭

試試看:

<IfModule mod_rewrite.c>
RewriteEngine On
DirectoryIndex /raaga/splash/index.php

#REWRITE RULES
#---------------------

# Not for real file or directory or /images/ directory or .gif...
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_URI} ^/images/ [NC,OR]
RewriteCond %{REQUEST_URI} \.(gif|jpe?g|png)$ [NC]
RewriteRule ^ - [L]

#RULE RAAGA_LABLE_ALBUM_DETAILS 
RewriteRule ^label/([a-zA-Z]*)/(albums|songs)/([^/]+)-([a-zA-Z0-9_-]*)/([^/]+)-([a-zA-Z0-9_-]*) /raaga/lable_home.php?l=$1&tab=$2&lbl=$4&mid=$6 [QSA]

#RULE RAAGA_LABLE_ 
RewriteRule ^label/([a-zA-Z]*)/([^/]+)-([a-zA-Z0-9_-]*) /raaga/lable_home.php?l=$1&lbl=$3 [QSA]

#RULE RAAGA_LABLE_ALBUM 
RewriteRule ^label/([a-zA-Z]*)/(albums|songs)/([^/]+)-([a-zA-Z0-9_-]*) /raaga/lable_home.php?l=$1&tab=$2&lbl=$4 [QSA]

#RULE RAAGA_MOVIEDETAIL_PLAY 
RewriteRule ^([a-zA-Z0-9_-]*)/album/([^/]+)-([a-zA-Z0-9_-]*)-play /raaga/albumpage.php?l=$1&mid=$3&autoplay=play [L]

#RULE RAAGA_MOVIEDETAIL 
RewriteRule ^([a-zA-Z0-9_-]*)/album/([^/]+)-([a-zA-Z0-9_-]*) /raaga/albumpage.php?l=$1&mid=$3 [L]

#RULE RAAGA_PROFILE_FAV_ALBUM_PLAY 
RewriteRule ^profile/([^/]+)-([a-zA-Z0-9_-]*)/([a-zA-Z]*)/albums/([^/]+)-([a-zA-Z0-9_-]*)-play /raaga/profile.php?uid=$2&ty=$3&page=album&mid=$5&autoplay=play [L]


ErrorDocument 404 /raaga/oops_404.php
ErrorDocument 500 /raaga/oops_500.php
</IfModule>

AddType application/octet-stream ts
AddType application/x-web-app-manifest+json webapp

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM