php - Apache, .htaccess - Not working locally -


i have rewrite rule in .htaccess.

rewriterule ^(.+?)$ /user_home.php?domain=$1 [l,qsa] 

which redirects mysite.com/mypage mysite.com/user_home.php?domain=mypage

this works fine on shared host, when working locally, site located in www/mysite/ , instead of redirecting www/mysite/user_home.php?domain=mypage tries redirect www/user_home.php?domain=mypage doesn't exist.

i following error in apache logs

[error] [client ::1] script 'c:/wamp/www/user_home.php' not found or unable stat 

how can alter .htaccess make direct file in current directory using relative path instead of absolute path..

you need remove leading slash target url in rule this:

rewritecond %{request_filename} !-f rewriterule ^(.+?)/?$ user_home.php?domain=$1 [l,qsa] 

rewritecond %{request_filename} !-f needed prevent infinite looping.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -