Link to home
Start Free TrialLog in
Avatar of shtoom
shtoom

asked on

The requested URL was not found.. - url rewrite not working ?

I just installed a mini cms and I have added this site to my virtual host files. The base url is:
minicms.local

When I go to minicms.local in the browser I see the homepage correctly but when i click on a link thats past the index.php i got this browser message:
Not Found
The requested URL /whatson/ was not found on this server.

wth is going on?

I think it may have something to do with the .htaccess file in this site? because in the .htaccess file there is this:

RewriteRule ^whatson$ /whatson/ [R]
RewriteRule ^whatson/(template=([a-zA-Z]+))?$ /index.php?content=whatson&template=$2

If i go to the long url it works but the shorterned version doesnt?

basically this should work but doesnt:
minicms.local/whatson

instead i get this:
Not Found
The requested URL /whatson/ was not found on this server.

for some strange reason this link works and shows me the webpage correctly:
minicms.local/index.php?content=whatson&template=$2

If anyone has any ideas why the minicms.local/whatson/ doesnt work please let me know!?

This is in my apache vhost file:
<VirtualHost *:80>
   DocumentRoot "M:\web\websites\minicms"
   ServerName minicms.local
</VirtualHost>
Avatar of caterham_www
caterham_www
Flag of Germany image

> in the .htaccess file there is this:

Where is

"RewriteEngine on"?

Also, but not related, add L-flags
RewriteEngine on
RewriteRule ^whatson$ /whatson/ [R=301,L]
RewriteRule ^whatson/(template=([a-zA-Z]+))?$ /index.php?content=whatson&template=$2 [L]

Open in new window

Avatar of shtoom
shtoom

ASKER

RewriteEngine on is at the top

if i take out the .htaccess file nothing changes.. this is strange..

This is how my .htaccess file looks:
RewriteEngine on

RewriteRule ^pages/pubposter$ /pubposter/ [R]
RewriteRule ^pages/pubposter/$ /pubposter/ [R]

RewriteRule ^pubposter$ /pubposter/ [R]
RewriteRule ^pubposter/$ /index.php?content=pages&id=pubposter

RewriteRule ^pages/([a-zA-Z0-9_-]+)$ /pages/$1/ [R]
RewriteRule ^pages/([a-zA-Z0-9_-]+)/(template=([a-zA-Z]+))?$ /index.php?content=pages&id=$1&template=$3

RewriteRule ^whatson$ /whatson/ [R]
RewriteRule ^whatson/(template=([a-zA-Z]+))?$ /index.php?content=whatson&template=$2

ErrorDocument 404 /pages/404_not_found/

RewriteRule ^sport* /pages/events/ [L,R=301]
RewriteRule ^photogallery* /pages/photo-gallery/ [L,R=301]
Always add L flags, you don't want to continue rewriting with the new path. R uses the status code 302, that is not good for search engines; use 301 instead.

Make sure AllowOverride FileInfo is set:
<VirtualHost *:80>
   DocumentRoot "M:\web\websites\minicms"
   ServerName minicms.local
   <Directory "M:\web\websites\minicms">
       AllowOverride FileInfo
   </Directory>
</VirtualHost>

Open in new window

Avatar of shtoom

ASKER

I added that new virtual host with AllowOverride FileInfo and I still get the same message for all pages using url rewrite:
Not Found

The requested URL /pages/news/ was not found on this server.


Avatar of shtoom

ASKER

any more ideas.. anyone.. ? please!
if removing or adding a .htaccess file isn't doing anything, then it isn't even being called.

set it to:
AllowOverride All

and make sure AccessFileName is set correctly:
AccessFileName .htaccess
Avatar of shtoom

ASKER

I just changed everything in the apache file http.config that said
AllowOverride None
to
AllowOverride All

now I get this message with 404 at the end:


Not Found
 
The requested URL /pages/membership/ was not found on this server.
 
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Open in new window

the htaccess file is now being correctly found, but there is probably an error in your htaccess.

i looked at line
RewriteRule ^pages/([a-zA-Z0-9_-]+)$ /pages/$1/ [R]

and it doesn't make sense? you are redirecting pages/membership to pages/membership/

do you have a membership folder with an index file in that directory?

you are getting the additional 404 error because the page /pages/404_not_found/ does not exist.
Avatar of shtoom

ASKER

I dont have a membership folder. I have a folder called modules with a file called pages.php inside.

This line:
RewriteRule ^pages/([a-zA-Z0-9_-]+)$ /pages/$1/ [R]
will pick up the menu name that was created in the cms.

This is all the references in the .htaccess file for membership:

RewriteRule ^membership(/)*$ /pages/membership/
RewriteRule ^tickets/membership.html /pages/membership/ [L,R=301]

If the user types
http://minicms.local/membership/
it will work but the true link is
http://minicms.local/pages/membership/ 

The only other place membership can be found in is the MySQL db.

Are we getting closer?
Avatar of shtoom

ASKER

just to note when I said the following I meant for the live site........::
If the user types
http://minicms.local/membership/
it will work but the true link is
http://minicms.local/pages/membership/ 

this works for the live site (minicms.com <-example) i didnt mean local.. IT DOESNT WORK LOCALLY. :((


Avatar of shtoom

ASKER

>> smueller72: you are getting the additional 404 error because the page /pages/404_not_found/ does not exist.

The 404 page is created when the cms is installed. I can login to the cms by going to: minicms.local/admin and I can view/edit the 404 page. But why I cannot go to http://minicms.local/pages/404_not_found/ is beyond me..
Please help ?
Avatar of shtoom

ASKER

I am going to increase the points because I am desperate here!
Avatar of shtoom

ASKER

need some help debugging the problem.. can anyone help please
Avatar of shtoom

ASKER

for some reason when i click on apache restart it doesnt actually restart in the browser it freezes.. I have to click stop and start for it to operate again.. I doubt this is causing the rewrite problems?
Can you post the complete config to check if there's some conflict somewhere?
Avatar of shtoom

ASKER

I have attached my apache httpd.config file.
For some reason on my other computer in windows explorer the httpd file looks like this: httpd.config but on this computer it looks like this httpd missing .config..

httpd.txt
ASKER CERTIFIED SOLUTION
Avatar of caterham_www
caterham_www
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
Avatar of shtoom

ASKER

wow it works thanks!