PDA

View Full Version : Mod_rewrite Problem



mattpattberg
06-21-2005, 12:39 PM
Hi Guys!

Love this software. It really is great.

I am having issues with getting the search engine friendly urls to work.

I changed to .htacces-or file to be .htaccess. Then I changed in the configuration to have the urls be 'search engine friendly'.

The files currently in the .htaccess files are made to look like .html files. However, when I click on one (i.e. - main.html instead of main.php) all I get is a 404 error page. Does this mean my server really doesn't support mod_rewrite? My server is Globat - and they do specifically say they support mod_rewrite. I have a question to them as well...

On a side note, I have done some tweeking to the php code here and there. Could that have done anything? I haven't tweeked anything to do with the url structure though.

I appreciate any comments you guys might have.

Matt

pbflash
06-21-2005, 01:12 PM
Did you try a phpinfo file to see if the host have mod_rewrite enabled?

greengiant
06-21-2005, 01:58 PM
Can you post a link, becuase the main.html file you mentioned doesnt exsist in OR or in teh rewrite command.

mattpattberg
06-21-2005, 02:23 PM
Can you post a link, becuase the main.html file you mentioned doesnt exsist in OR or in teh rewrite command.

This was just an example... not actually what it was. I think it was index.html... I didn't pay too close attention - I just had to disable it because this is a live site.

My site is www.hudhunters.com (http://www.hudhunters.com)


As for the phpinfo... I just barely did it, but there is no apache info to tell me if mod_rewrite is enabled.

Thanks for all your help guys.

mattpattberg
06-23-2005, 02:34 PM
No other ideas?...

mattpattberg
06-28-2005, 08:15 PM
Hi!

My host finally got back to me and told me I might need to use rewritebase...

I have searched on the tutorials about mod_rewrite on the applicable websites... but just can't figure out exactly what I should put in the rewritebase... Would anyone have any suggestions?

Am I supposed to put in the url of my website? just a /? stumped here...

Thanks for any help guys!

Matt

hmag
06-29-2005, 05:33 AM
Hi again,
Like the original poster, as a test, I switched over to search engine friendly URLs - our server has mod_rewrite on, which is listed in the PHP info, but I get a 404 if I try anything other than the front page.

Are there any special requirements to get this working?

Any assistance greatly appreciated.

mts
06-29-2005, 11:19 AM
Apache v1.3.33
doesn't support this kind of searchengine friendly url

only the higher version does,
but they aren't stable and so I wouldn't like to use them.

only with 'index.php' it would work, like:
mydomain/index.php/bla/blubb

lG
mts

leeuniverse
06-29-2005, 01:04 PM
Hey Matt.... I'm over at Site5.com and everything seems to be working for me for everything else, and when I switched to search engine friendly URL's. I had your problem too, but I didn't know about the .htacces file, AGAIN had to weed through the forum to know how to use something after changing a setting in the Config. :( (did the same for figuring out how Agents are supposed to sign up and login after enabling the setting) But, it works great for me now.....
They seem the most professional for the low price and amount of features. Very timely and excellent support if ever needed.

mattpattberg
06-29-2005, 04:09 PM
Hi Guys!

I figured it out... couldn't find any answers, so I just experimented.. luckily it worked for me.

All I had to do was put

"RewriteBase /"

Just under the RewriteEngine On...

This is just for my server though. They told me I needed that extra code. I don't know if this would help other people with the same problem.

Thanks for all your guy's help!

Matt

zorbas2
07-05-2005, 09:00 AM
The first lines of my .htaccess look now like this and it works now with 1&1 or Schlund - Germany:

# SEARCH ENINGE FRIENDLY URLS FOR OR 2.0
<IfModule mod_php4.c>
php_value session.use_trans_sid 0
</IfModule>

Options -MultiViews
RewriteEngine On
RewriteBase /

:)

thunderMex
07-05-2005, 11:15 PM
I also am testing on 1and1.com and with a php info file I don't find that they have the rewrite engine even installed. I DID try the modification of zorbas2 on the original .htaccess file installed in the root directory, nevertheless--

<IfModule mod_php4.c>
php_value session.use_trans_sid 0
</IfModule>

Options -MultiViews
RewriteEngine On
RewriteBase /

(and the rest of the .htaccess-or continues....)

BUT, a switch over to Search Engine friendly urls in the configuration of OR 2 continued to create 404 errors, including that selecting Home produced a call for "index.html" which the server informed me did not exist. Even though my my file contains DirectoryIndex index.php --which the staff at 1and1.com suggested I put in so that it first looked for index.php if just the url was entered.

mattpattberg
07-06-2005, 03:43 PM
I also am testing on 1and1.com and with a php info file I don't find that they have the rewrite engine even installed. I DID try the modification of zorbas2 on the original .htaccess file installed in the root directory, nevertheless--

<IfModule mod_php4.c>
php_value session.use_trans_sid 0
</IfModule>

Options -MultiViews
RewriteEngine On
RewriteBase /

(and the rest of the .htaccess-or continues....)

BUT, a switch over to Search Engine friendly urls in the configuration of OR 2 continued to create 404 errors, including that selecting Home produced a call for "index.html" which the server informed me did not exist. Even though my my file contains DirectoryIndex index.php --which the staff at 1and1.com suggested I put in so that it first looked for index.php if just the url was entered.

Hi!

Here is a link (http://faq.1and1.com/scripting_languages_supported/configuring_apache_server_using_htaccess/4.html) from your host that says htacces is possbile.

I would first try creating a bogus file in the htaccess file to see if it works as-is.

For example;
Take the htaccess file back to the original file, then create a redirect that says test.html will go to index.php. Save and upload the file.
Then type www.yourwebsite.com/whateverpathsyouhave/test.html - if you don't get your main OR website, then you would need to try something else. It took me a while to figure it out for my site. My host said I needed to add the rewritebase line, you might not need that part.

I hope this makes some sense.

Fist
09-08-2005, 09:04 AM
I also am testing on 1and1.com and with a php info file I don't find that they have the rewrite engine even installed. I DID try the modification of zorbas2 on the original .htaccess file installed in the root directory, nevertheless--

<IfModule mod_php4.c>
php_value session.use_trans_sid 0
</IfModule>

Options -MultiViews
RewriteEngine On
RewriteBase /

(and the rest of the .htaccess-or continues....)

BUT, a switch over to Search Engine friendly urls in the configuration of OR 2 continued to create 404 errors, including that selecting Home produced a call for "index.html" which the server informed me did not exist. Even though my my file contains DirectoryIndex index.php --which the staff at 1and1.com suggested I put in so that it first looked for index.php if just the url was entered.

I think the / after RewriteBase is meant to be your base URL

I changed it from / to www/ and instead of 404 error cannot be found I am now getting 500 error cannot be displayed. So now atleast it's finding the right place but still won't work right for me.

matteoraggi
02-16-2006, 09:25 AM
I have renamed mod_rewrite on the root as .htaccess and give it 777 permissions but I continue having the File Not Found 404 Erorr on urls... why?
I know mod_rewrite go with my internet provider, because I have a lot of web sites with wordpress on it, going with mod_rewrite..

the site is:
Poland Real Estate (http://www.polandrealestate.org)

the_sandking
02-16-2006, 11:34 AM
Hi!

Here is a link (http://faq.1and1.com/scripting_languages_supported/configuring_apache_server_using_htaccess/4.html) from your host that says htacces is possbile.



Having .htaccess available does not necessarily mean that your host supports APACHE's mod_rewrite.

An .htaccess file is just a container that holds override commands that will alter APACHE's behaviour.

matteoraggi
02-18-2006, 02:41 PM
YES! now it go!
I was using it:


# SEARCH ENINGE FRIENDLY URLS FOR OR 2.0
<IfModule mod_php4.c>
php_value session.use_trans_sid 0
</IfModule>

RewriteEngine On
RewriteBase /

Rewriterule ^index.html index.php
RewriteRule listing-([^-]*)-([0-9]*).html index.php?action=listingview&listingID=$2 [L]
RewriteRule page-([^-]*)-([0-9]*).html index.php?action=page_display&PageID=$2 [L]
RewriteRule search.html index.php?action=searchpage [L]
RewriteRule searchresults.html index.php?action=searchresults [L]
RewriteRule agents.html index.php?action=view_users [L]
RewriteRule view_favorites.html index.php?action=view_favorites [L]
RewriteRule calculator.html index.php?action=calculator&popup=yes [L]
RewriteRule saved_searches.html index.php?action=view_saved_searches [L]
RewriteRule listing_image_([0-9]*).html index.php?action=view_listing_image&image_id=$1 [L]
RewriteRule logout.html index.php?action=logout [L]
RewriteRule member_signup.html index.php?action=signup&type=member [L]
RewriteRule agent_signup.html index.php?action=signup&type=agent [L]
RewriteRule member_login.html index.php?action=member_login [L]
RewriteRule edit_profile_([0-9]).html index.php?action=edit_profile&user_id=$1 [L]



--------

I was just thinking that changing something this could go again, but it isn't:
change it:
RewriteRule listing-([^-]*)-([0-9]*).html
to:
RewriteRule real_estate-([^-]*)-([0-9]*).html

don't go, why?

Poland Real Estate (http://www.polandrealestate.org)

the_sandking
02-18-2006, 03:10 PM
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

jlamb
03-02-2006, 12:44 AM
I am trying to create a rewrite rule for the user page addon. Here is what I put on .htaccess:

RewriteRule user_page.html index.php?action=addon_userpage_showpage [L]

nothing happens. any ideas? I read the apache documentation, but still didn't get what I was doing wrong.

Thanks.

pbflash
03-02-2006, 01:44 AM
What do you mean by 'nothing happens'? Do you get an error, a blank page?

jlamb
03-02-2006, 01:48 AM
sorry, I had to change the addon.inc.php file to display the user_page.html link. Now every thing is great.

lanesharon
03-02-2006, 03:52 AM
I have something unusual going on with a 2.2 install. I set it up to use the 'search engine friendly' option. No problem in getting to the links, but what is unusual is that my index.php page shows the page links in one format. If I click on that link, it takes me to the page with no problem and now it converts the links to the search engine friendly URLs.

For Example: I call for a link to the "contact" (titled Contact Us) page by calling {page_link_2}. On my index page, the links shows as - /page--2.html (which is not search engine friendly!).
Once I click on any link, that same link turns to /page-Contact%20Us-2.html (still not really search engine friendly!).
If I retitled it Contact_Us, it will show up as /page-Contact_Us-2.html, which is not really Google friendly because Google looks at this as Contact_Us as one word, not two.
If I try to retitle it as Contact-Us (which Google would look at as two word), it won't work (except on the /index.html page where it still shows as page--2.html on the clickable link, as I stated above). If I try to click the link from a subsequent page (with the hyphenated Google friendly URL), I get a 404 error page.

I would like to use this rewrite system so that it can give me some help in the Google rankings. Which means, I would like to use multiple words for links and have them be translated by Google as multiple words.

I am not very familiar with Mod Rewrite. The rewrite rule on OR that is involved in these page links is:
RewriteRule page-([^-]*)-([0-9]*).html index.php?action=page_display&PageID=$2 [L]

I have WordPress Blog and it rewrites page names with hyphens in them. Is it possible to change OR so that it can do the same?

I noticed that there is an element in the pagesmain table called pagesmain_summary. Since this element does not seem to be used anywhere, couldn't it be used to store the mod rewrite link name?

justice
03-02-2006, 08:51 AM
I am trying to create a rewrite rule for the user page addon. Here is what I put on .htaccess:

RewriteRule user_page.html index.php?action=addon_userpage_showpage [L]

nothing happens. any ideas? I read the apache documentation, but still didn't get what I was doing wrong.

Thanks.

It would probably help if you posted your .htaccess file. Sometimes, where you put these rules in the file does have a significant impact as well.

jlamb
03-02-2006, 10:22 AM
Here is a few other changes I made to .htaccess:


RewriteRule contact.html index.php?action=page_display&PageID=2 [L]
RewriteRule land.html index.php?pclass[%5]B[%5]D=2&action=searchresults [L]
RewriteRule residential.html index.php?pclass[%5]B[%5]D=1&action=searchresults [L]
RewriteRule commercial.html index.php?pclass[%5]B[%5]D=4&action=searchresults [L]

I had to modify the links on my pages to call contact.html instead of {page_link_2}.

You can check it out at http://classicrealtyaz.net. It is built on 2.2, but it is a long way from finished. I just started last night. Hope this helps.