简体   繁体   English

在Apache 2.2 centos 6.5中进行Mod Rewrite

[英]Mod Rewrite in apache 2.2 centos 6.5

I am trying write the friendly seo url (rewrite rule) in the htaccess, i am getting error. 我正在尝试在htaccess中写入友好的seo url(重写规则),但出现错误。

when i checked mod_rewrite is installed as static. 当我检查mod_rewrite安装为静态。 please check it below 请在下面检查

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)

Below is my htaccess code 以下是我的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

Please help me what mistake i am doing. 请帮我什么错。 The above code is working in another server in that folder we have project in public_html itself, but here it is public_html/raaga so i had added /raaga/register.php instead of /register.php 上面的代码在该文件夹中的另一台服务器上工作,我们在public_html本身中有项目,但是这里是public_html / raaga,所以我添加了/raaga/register.php而不是/register.php

server , 服务器,

i dont think mistake in htaccess, it will be httpd.conf, what i have to change in httpd.conf file . 我认为htaccess中不会出现错误,它将是httpd.conf,我必须在httpd.conf文件中进行更改

Thanks 谢谢

Thanigaivelan 塔尼盖维兰

Try with that: 试试看:

<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