Link to home
Start Free TrialLog in
Avatar of Elham_Seif
Elham_Seif

asked on

Error in redirect

I'm using an open source eclup(Elgg), when I wanne to run  and view it in my browser, it won't work.
I checked the logs and I found the error in the "apache_error" file:
"[error] [client 127.0.0.1] cannot redirect '/elgg1.6.1' to 'index.php'; target is not a valid absoluteURI or abs_path, referer: http://localhost/ "
I'm new in PHP and open source projects, please help me to fix this. Thanks.
Avatar of ahoffmann
ahoffmann
Flag of Germany image

please post the corresponding RewriteRule directive from your httpd.conf and/or .htaccess file (please do not post the complete httpd.conf, just the Rewrite* lines)
Avatar of Elham_Seif
Elham_Seif

ASKER

I just find the .htaccess file:
"
RewriteRule ^action\/([A-Za-z0-9\_\-\/]+)$ engine/handlers/action_handler.php?action=$1

RewriteRule ^export\/([A-Za-z]+)\/([0-9]+)$ services/export/handler.php?view=$1&guid=$2
RewriteRule ^export\/([A-Za-z]+)\/([0-9]+)\/$ services/export/handler.php?view=$1&guid=$2
RewriteRule ^export\/([A-Za-z]+)\/([0-9]+)\/([A-Za-z]+)\/([A-Za-z0-9\_]+)\/$ services/export/handler.php?view=$1&guid=$2&type=$3&idname=$4

RewriteRule ^\_css\/css\.css$ _css/css.php

RewriteRule ^pg\/([A-Za-z0-9\_\-]+)\/(.*)$ engine/handlers/pagehandler.php?handler=$1&page=$2
RewriteRule ^pg\/([A-Za-z0-9\_\-]+)$ engine/handlers/pagehandler.php?handler=$1

RewriteRule xml-rpc.php engine/handlers/xml-rpc_handler.php
RewriteRule mt/mt-xmlrpc.cgi engine/handlers/xml-rpc_handler.php

RewriteRule ^tag/(.+)/?$ engine/handlers/pagehandler.php?handler=search&page=$1
"
Is that you mean?
yes, that's what I mean.
The rules look fine to me.

Are there other hints in your error_log file?
Can you please post th eURL you used in your browser.
The eURL I'm using is:"http://localhost/elgg1.6.1"
And I didn't find any other error related to this.
this URL soes not match any of the posted rewrite rules
As the rewrite rules are all from a .htaccess file, you need to check your httpd.conf (which should not be a problem as it is localhost:)
I can't find the httpd.conf file. Where should it be? Can I Creat it ?
> Where should it be?

depends on your distribution
    ps ax |grep httpd
or
   ps -el |grep httpd
should show how httpd ist started, most likely with the -c option telling where to find the configuration file


> Can I Creat it ?
why? it's already there, otherwise your apache won't run proper.
This is not an issue of mod_rewrite and RewriteRules, it's one of mod_alias and its Redirect directives.

The error is by bad design of your open source software used. They use

    # ugly ugly hack to detect missing mod_rewrite
    # RedirectMatch must be to an absolute destination, so forces 500 error...
    ErrorDocument 500 "Elgg error: Apache does not have mod_rewrite loaded. Please check your Apache setup."
    RedirectMatch 302 .* index.php



They're creating an internal server error with the invalid RedirectMatch syntax to point out (with the ErrorDocument directive) that the module mod_rewrite is missing.
I can't Understad.  Now What I can do?
Load the module mod_rewrite into your server configuration. The first step is to locate your httpd.conf as pointed out by ahoffmann if you don't know its location.
Finally I find the httpd.conf files!
1-C:\Program Files\EasyPHP5.3.0\conf_files
2-C:\Program Files\EasyPHP5.3.0\apache\conf
3-C:\wamp\bin\apache\Apache2.2.11\conf
4-C:\wamp\bin\apache\Apache2.2.11\conf\original
Which one And which part of that should I check?
I guess httpd.conf should be in 3.
But as it is apache 2.2, you most likely have some more files included there. See the Include directive in httpd.conf where these files are to be found.
The files ..
1-C:\Program Files\EasyPHP5.3.0\conf_files
      my.Configuration Settings
      php.Configuration Settings
      httpd.conf 40kb
2-C:\Program Files\EasyPHP5.3.0\apache\conf
      extra (folder)
      openssl (SpeedDail)
      charset.conv
      mime.types
      magic
      httpd.conf 41kb
3-C:\wamp\bin\apache\Apache2.2.11\conf
      extra (folder)
      original (folder)
      openssl (SpeedDail)
      charset.conv
      mime.types
      magic
      httpd.conf 18kb
4-C:\wamp\bin\apache\Apache2.2.11\conf\original
      extra (folder)
      charset.conv
      mime.types
      magic
      httpd.conf 18kb

you have three choices, ask the person who installed the software ;-)
Don't have my crystall ball handy, sorry.
OK,
What should I check in httpd.conf? ,Is there somting to load to it?

please post all Redirect* and Rewrite* directive (just the active ones, not the comment out ones)
LoadModule rewrite_module modules/mod_rewrite.so
I just find this. But there wasn't any active Redirect module.
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I searched in included files, but didn't find any thing.
 
Untill now I was seen "HTTP 500 - Internal server error"  when I click on my eclub name,
2 min ago I add "Redirect /elgg1.6.1 http://localhost/elgg1.6.1/index.php" to the . htaccess file and  find the page as below:
"The page cannot be displayed"
...
"Cannot find server or DNS Error " 
What are these saying?
>> ... mod_rewrite.so
>If I look at your other comments, you're on a windoze system, but this line tries to load a UNIX shared >object library. Sounds like you have a misconfigured file for your system.
--What  can I do for it?!
Finally My web site loaded.
I copy this to httpd.conf and it worked.

LoadModule rewrite_module modules/mod_rewrite.so

<Directory />
AllowOverride All
</Directory>
Thanks for your help.