How to rewrite module in apache?

Status
Not open for further replies.

MediaStar

Active Member
2,674
2010
446
515
Guys, im doing testing for my PLG script. Tested on shared hosting + cPanel its working fine.

But the problem now is when im install apache + php5 without cpanel on my vps, site is working fine but not fully function. I can generate the link but cannot download it, error not found the file.

My script need to rewrite this:

Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^static/(.*) index.php?q=$1

I create .htaccess and put the code but still no luck. Should i put this code at other place at httpd.conf or etc etc?
 
9 comments
Just a query.. Is it godaddy hosting?
They have pretty strict .htaccess rewrite restrictions.
(They let you use it within the root directory of your hosting account only.)

Or try

RewriteRule ^([^/]+)/?$ index.php?q=$1
(ensure that 'q' is really the value your lookign for..)
 
Just a query.. Is it godaddy hosting?
They have pretty strict .htaccess rewrite restrictions.
(They let you use it within the root directory of your hosting account only.)

Or try

RewriteRule ^([^/]+)/?$ index.php?q=$1
(ensure that 'q' is really the value your lookign for..)

Its working fine with shared hosting, the problem now is with my vps (not godaddy)

will try your code ;)

updated: still no luck :((
 
Last edited:
Did you uncomment modrewrite module from httpd.conf ?

find in httpd.conf and uncomment this

LoadModule rewrite_module modules/mod_rewrite.so

then find this in same file

</FilesMatch>

comment this whole tag by adding # in start, that start from <FilesMatch "^\.ht">

and add this

<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>


restart apache

service httpd restart
 
Did you uncomment modrewrite module from httpd.conf ?

find in httpd.conf and uncomment this



then find this in same file



comment this whole tag by adding # in start, that start from <FilesMatch "^\.ht">

and add this




restart apache

[SLIDE]http://imageditings.com/images/NEFqK.png[/SLIDE]

Cannot find </FilesMatch> mate but got this one

JkgG.png
 
That's fine,

try remove this ~ . save and restart apache. and then check.

i don't know your website nature, directories etc. so i don't have exact idea about which directory it seen ?

this is usually a directory or miss place string issue.
 
That's fine,

try remove this ~ . save and restart apache. and then check.

i don't know your website nature, directories etc. so i don't have exact idea about which directory it seen ?

this is usually a directory or miss place string issue.

Still same, this is my directory

Code:
/home/public_html/DOMAIN.com/public
 
What kind of website its ? any CMS or custom application ?

make sure directory setting exactly pointed. similar to this settings

<Directory "/home/public_html/DOMAIN.com/public">

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>
 
Status
Not open for further replies.
Back
Top