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.
ProgrammingApache Web ServerProgramming Languages-Other

Avatar of undefined
Last Comment
Elham_Seif

8/22/2022 - Mon
ahoffmann

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)
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?
ahoffmann

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.
Your help has saved me hundreds of hours of internet surfing.
fblack61
Elham_Seif

ASKER
The eURL I'm using is:"http://localhost/elgg1.6.1"
And I didn't find any other error related to this.
ahoffmann

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:)
Elham_Seif

ASKER
I can't find the httpd.conf file. Where should it be? Can I Creat it ?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ahoffmann

> 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.
caterham_www

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.
Elham_Seif

ASKER
I can't Understad.  Now What I can do?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
caterham_www

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.
Elham_Seif

ASKER
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?
ahoffmann

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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Elham_Seif

ASKER
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

ahoffmann

you have three choices, ask the person who installed the software ;-)
Don't have my crystall ball handy, sorry.
Elham_Seif

ASKER
OK,
What should I check in httpd.conf? ,Is there somting to load to it?

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ahoffmann

please post all Redirect* and Rewrite* directive (just the active ones, not the comment out ones)
Elham_Seif

ASKER
LoadModule rewrite_module modules/mod_rewrite.so
I just find this. But there wasn't any active Redirect module.
ASKER CERTIFIED SOLUTION
ahoffmann

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Elham_Seif

ASKER
I searched in included files, but didn't find any thing.
 
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Elham_Seif

ASKER
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?
Elham_Seif

ASKER
>> ... 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?!
Elham_Seif

ASKER
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>
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Elham_Seif

ASKER
Thanks for your help.