Topic: Getting Friendly URLs to work  (Read 101755 times)

Pages: 1 [2] 3 4 ... 15   Go Down

#21: 4-Aug-2006, 03:46 PM

scandiman
Posts: 36

Hi all, another newb here eager to use MODx but struggling with the FURL's & .htaccess stuff. I've been reading the forums trying to figure this out and I'm getting stuck. Successfully installed v0.9.2.1 w/ the sample content on my shared hosting account at 1and1 and all was great. I am pointing a subdomain to the destination directory that the MODx is installed in. Then I proceeded to use FURL's (Friendly URL's for those even greener than me). Selected YES to all options and kept the defaults for prefix and suffix. Then I went and updated the ht.access file to block the zlib and set the proper file path for a 1and1 install:

--------------

# php_flag zlib.output_compression On
# php_value zlib.output_compression_level 5

# Rewrite directives here for SEF (Search Engine Friendly) URLs

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# If your MODx installation is in a subdirectory, change the following line to match the physical
# path to the "root" of the site as follows:
# RewriteRule ^(.*)$ /path/to/subdirectory/index.php?q=$1 [L,QSA]

RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

---------


Then I uploaded the file and renamed it to .htaccess. Also renamed the ht.access file in the manager directory but made no changes to its content.

The result is that the default main page comes up fine but if I click on any internal link (such as "Simple Blog" or "Easy Comments") I get the following error: "Error 404: NOT FOUND!
Your browser cannot find the document corresponding to the URL you typed in."

The ht.access instructions says "# Make sure RewriteBase points to the directory where you installed MODx." but I never see the term RewriteBase anywhere else in the file. Do I need to add it somewhere? Is this causing my problems? Yea, I know, dumb newbie question but I'm just trying to follow the instructions and it's not adding up.

I'm sure I'm missing something simple but I have no idea what to do next. Any suggestions?
Visit MODx.mobi to read these forums on mobile devices.

#22: 4-Aug-2006, 06:04 PM

Coding Team

sottwell
Posts: 10,503

WWW
Code:
# If your MODx installation is in a subdirectory, change the following line to match the physical
# path to the "root" of the site as follows:
# RewriteRule ^(.*)$ /path/to/subdirectory/index.php?q=$1 [L,QSA]
is probably the answer to your problem. If you have your MODx installed in a subfolder of your web space (such as /modx/) then you need to use the above line, like
Code:
RewriteRule ^(.*)$ /modx/index.php?q=$1 [L,QSA]
sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html

#23: 4-Aug-2006, 06:33 PM

scandiman
Posts: 36

Code:
# If your MODx installation is in a subdirectory, change the following line to match the physical
# path to the "root" of the site as follows:
# RewriteRule ^(.*)$ /path/to/subdirectory/index.php?q=$1 [L,QSA]
is probably the answer to your problem. If you have your MODx installed in a subfolder of your web space (such as /modx/) then you need to use the above line, like
Code:
RewriteRule ^(.*)$ /modx/index.php?q=$1 [L,QSA]
I gave this a try but I get the same result. I go to the main page fine but when I click on a link I get the same 404 error saying it couldn't find the page. These links work fine if I switch to non-furl mode.

Any other suggestions out there for a desperate newb?
Visit MODx.mobi to read these forums on mobile devices.

#24: 4-Aug-2006, 10:15 PM

Coding Team

sottwell
Posts: 10,503

WWW
Do you have a link so we can take a look at what's happening?
sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html

#25: 4-Aug-2006, 10:30 PM

scandiman
Posts: 36

Do you have a link so we can take a look at what's happening?
Yes, go to modx.pngid.com and then click on Simple Blog or Easy Comments. Thanks for taking a look Cheesy
Visit MODx.mobi to read these forums on mobile devices.

#26: 4-Aug-2006, 11:49 PM

Administrator

zi
MODx Special Forces /
Posts: 3,555

May Peace Be On You

WWW
What is the actual directory from your hosting root folder?

e.g. /subdomains/modx ?

#27: 5-Aug-2006, 01:39 AM

scandiman
Posts: 36

What is the actual directory from your hosting root folder?

e.g. /subdomains/modx ?
I don't understand your question well enough to answer it accurately. What is a "hosting root folder?" At the 1and1 domain admin panel, I set up a "destination" for any domain or subdomain. In my specific case, I have modx.pngid.com set to the destination directory "name_modx1". As far as I know, this directory is now considered the "root". I did not add any sub directories. I installed the MODx 0.9.2.1 files via an FTP client into this "root" directory.

Are you referring to a different root on the server that exists prior to my administration?

Again, the site works fine until I switch to FURLs. Then any link from the main page gives the 404 error.

For reference, I have successfuly installed Mambo, Joomla! and Drupal in this environment so I'm not sure what is going wrong here.

To bump up a previous question about the .htaccess file... the instructions say...
Code:
# Make sure RewriteBase points to the directory where you installed MODx.
but there is no RewriteBase anywhere in the file. Is this the same as RewriteRule? Is something missing in the .htaccess file?

Thanks for all your help with this.
Visit MODx.mobi to read these forums on mobile devices.

#28: 5-Aug-2006, 02:17 AM

Coding Team

sottwell
Posts: 10,503

WWW
What is your full path to your index.php file?

example: /home/sites/mysite.com/public_html/
sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html

#29: 5-Aug-2006, 02:47 AM

scandiman
Posts: 36

What is your full path to your index.php file?

example: /home/sites/mysite.com/public_html/
In my FTP client, index.php is in the root, so it would be /index.php.

However, to the best I can determine, the server path is /homepages/25/accountnumber/name_modx/index.php

The /homepages/25/accountnumber is assigned to me and I am unable to make any changes to it.

I created the name_modx and it is the "root" destination for the subdomain modx.pngid.com

I have tried both of these (and any combo I can think of) in the .htaccess file to no avail.

Is this the info you are asking for?
Visit MODx.mobi to read these forums on mobile devices.

#30: 5-Aug-2006, 03:06 AM

scandiman
Posts: 36

I am no .htaccess expert (obvious from previous posts), but I looked into the files of both Joomla and Drupal and they both have this line of code:
Code:
RewriteBase /
but the MODx file does not have this line. I know I've asked it before but should it be in there somewhere or is it irrelevant?
Visit MODx.mobi to read these forums on mobile devices.

#31: 7-Aug-2006, 09:52 PM

scandiman
Posts: 36

Still no success in getting FURL's to work. I've completely reinstalled, tried many variations of file paths in the .htaccess but the same problems occur as described in the previous 2 or 3 posts in this thread.

Can anyone offer me some additional direction in how to resolve this? Am I overlooking a variable beyond the .htaccess file and the Sys Config FURLs admin panel? Is it wrong of me to assume FURL's should work with the default sample site right out of the box? I'm really eager to start building with this product but it kind of moot without Friendly URL's.

Signed...Desperate Huh
Visit MODx.mobi to read these forums on mobile devices.

#32: 8-Aug-2006, 10:22 AM

paulblackgsx
Posts: 9

WWW
Here is the .htaccess I use to get it to work on 1and1.  Hopefully this will help other 1and1 users.  This works for 1and1 domains where the root of the domain is pointed at a subdirectory.  Works like a champ on several sites.  The key was the RewriteBase / which isn't included in the default .htaccess that comes with the install package.

#php_flag zlib.output_compression On
#php_value zlib.output_compression_level 5

# Rewrite directives here for SEF (Search Engine Friendly) URLs

RewriteEngine on

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

#33: 8-Aug-2006, 11:32 AM

scandiman
Posts: 36

Here is the .htaccess I use to get it to work on 1and1.  Hopefully this will help other 1and1 users.  This works for 1and1 domains where the root of the domain is pointed at a subdirectory.  Works like a champ on several sites.  The key was the RewriteBase / which isn't included in the default .htaccess that comes with the install package.

#php_flag zlib.output_compression On
#php_value zlib.output_compression_level 5

# Rewrite directives here for SEF (Search Engine Friendly) URLs

RewriteEngine on

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
Hi and thank you very much for the feedback. I copied this verbatim into my .htaccess file, deleted everything else and still not working. Main page comes up but the links give a 404 error. What are you selecting in the Friendly URL settings admin panel?

Since it's working for you, I assume I am doing something else wrong but all I've done is the standard install and I'm following all the documentation to the letter. Once I figure this all out I want to prep some documentation to help others avoid whatever silly little problem that is holding me up.
Visit MODx.mobi to read these forums on mobile devices.

#34: 8-Aug-2006, 01:22 PM

paulblackgsx
Posts: 9

WWW
Here is the .htaccess I use to get it to work on 1and1.  Hopefully this will help other 1and1 users.  This works for 1and1 domains where the root of the domain is pointed at a subdirectory.  Works like a champ on several sites.  The key was the RewriteBase / which isn't included in the default .htaccess that comes with the install package.

#php_flag zlib.output_compression On
#php_value zlib.output_compression_level 5

# Rewrite directives here for SEF (Search Engine Friendly) URLs

RewriteEngine on

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
Hi and thank you very much for the feedback. I copied this verbatim into my .htaccess file, deleted everything else and still not working. Main page comes up but the links give a 404 error. What are you selecting in the Friendly URL settings admin panel?

Since it's working for you, I assume I am doing something else wrong but all I've done is the standard install and I'm following all the documentation to the letter. Once I figure this all out I want to prep some documentation to help others avoid whatever silly little problem that is holding me up.

Use friendsly URL: Yes
Prefix: [Blank]
Suffix: .html
Use friendly Alias: Yes
Use friend paths: No
Allow duplicates: Yes
Automatically Generate: Yes

Hope this helps.  Send me a PM if you need some additional assistance and want to take it offline.
« Last Edit: 8-Aug-2006, 01:26 PM by paulblackgsx »

#35: 8-Aug-2006, 06:53 PM

scandiman
Posts: 36

Happy to report that it now works fine. paulblackgsx confirmed my htaccess and settings were good and made a passing comment that it is acting as if it doesn't see the file at all. That gave me the idea to switch to a different plaintext editor. Resaved the file and it works great now. Something I've used for years now decides to add some hidden characters. What a stupid problem but it is always good to go back to the basics sometimes.

All of this did reveal though that the default .htaccess file is missing something. paulblackgsx pointed out that "RewriteBase /"  should be added into the .htaccess code. Is there some place to report something like this?
« Last Edit: 8-Aug-2006, 07:12 PM by scandiman »
Visit MODx.mobi to read these forums on mobile devices.

#36: 8-Aug-2006, 07:18 PM

Foundation

OpenGeek
MODx Co-Founder
Posts: 6,938

damn accurate caricatures...

WWW
All of this did reveal though that the default .htaccess file is missing something. paulblackgsx pointed out that "RewriteBase /"  should be added into the .htaccess code. Is there some place to report something like this?

Honestly, the presence or non-presence of the RewriteBase is not always necessary.  It pretty much depends on where and how your site is configured, and how it is going to interact with other traditional web resources within the same space.  I've even run into several cases where using RewriteBase was in fact breaking the rules, so I'm not convinced this needs to be in the default .htaccess code.  However, my expertise with mod_rewrite is infantile at best, so, others with better experience here, please chime in if you think this should be a standard part of the .htaccess we provide as a starting point.
Jason Coward
MODx Co-Founder
xPDO Founder
CTO @ Collabpad
work productively.
work intelligently.
work together.
Light is just a vibration of a note too. Everything is. You've got to keep that in mind.
  Frank Zappa

#37: 8-Aug-2006, 08:21 PM

PaulGregory
MODx's midnight runner
Posts: 1,097

MODx's midnight runner

WWW
paulblackgsx didn't actually say it should be added to the default .htaccess, he just said that it's not in the default one and people need to add it if they have a particular setup.

With that in mind, I chime in with "have it in there but commented out, with a note suggesting that people take it out if the root of the domain is pointed at a subdirectory".

That would seem like the best solution all around.
No, I don't know what OpenGeek's saying half the time either.
MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
Forum: Where to post threads about add-ons | Forum Rules
Like MODx? donate (and/or share your resources)
Like me? See my Amazon wishlist
MODx "Most Promising CMS" - so appropriate!

#38: 8-Aug-2006, 09:09 PM

paulblackgsx
Posts: 9

WWW

Yeah, it won't be needed in all cases, but likely would be helpful to anyone using a host that hosts multiple domains, with each domain in a subdirectory, and the domain is pointed at the subdirectory so it operates like it's the root.

Including it in the default folder remarked out may not be a bad idea if a lot of other people on hosting solutions other than 1and1 run into this problem.

Glad I could help.  I hope this info comes in handy to other people as well. 

#39: 9-Aug-2006, 04:23 AM

dopster00
Posts: 7

Hi! Im new to using modx and php, but ive had experiences using cms built in Java. (openCms, lenya).
So far, im having more fun using modx! Wink Props!

Anyway, here's what i can contribute:

For those who are trying to install a staging site on Windows, this can help you in configuring FURLs:

Specs:
Windows XP
Apache2
MySQL 5
PHP 5.1.4

1) Go to administration -> System Configuration -> Friendly URL Settings
2) Set Use Friendly URLs to Yes. Just set every option by default for now.
3) Rename ht.access to .htaccess inside modx root. (i.e. C:\Apache2\htdocs\modx\ht.access -> C:\Apache2\htdocs\modx\.htaccess)
4) Edit .htaccess
      comment these lines,
      php_flag zlib.output_compression On
      php_value zlib.output_compression_level 5

      change this,
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
      into
      RewriteRule ^(.*)$ /modx/index.php?q=$1 [L,QSA]
     
5) Edit the configuration file of Apache 2.
    Uncomment this line,
#LoadModule rewrite_module modules/mod_rewrite.so

and change this

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride None
     
into
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride All

Note: There are about 5-6 AllowOverride string inside httpd.conf. Change the one above specifically. Smiley

6) Reload Apache.

That's it! Whew! Smiley

#40: 18-Aug-2006, 01:55 AM

myfriendscallmebill
Posts: 90

Howdy, I've spent hours looking/searching through the forum and haven't seen my problem addressed (in a form I 'd recognize ;-), so I'll try asking here:

I've been building a MODx site for a few weeks now.  I intially set it up (successfully) to use friendly URLs in the form:

    <domain>/<alias>.html 

Now I've decided that I'd rather use IDs rather than aliases, with URLs in the form:

    <domain>/<id>.html

But when I turn off "use friendly aliases" in the System Configuration portion of the Manager, any time I try to go beyond the home page, either by clicking a link on the home page or by typing in the URL manually (<domain>/<id>.html)  my "page not found" page is displayed (that's error 404 isn't it?).

When I turn "use friendly aliases" back on, the site starts working again.

Any idea how to get it to work with  "use friendly aliases" turned off?
Pages: 1 [2] 3 4 ... 15   Go Up
0 Members and 1 Guest are viewing this topic.