简体   繁体   中英

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.

when i checked mod_rewrite is installed as static. 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

   <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

server ,

i dont think mistake in htaccess, it will be httpd.conf, what i have to change in httpd.conf file .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM