Author Topic: removing the /pages/ from the address  (Read 8357 times)

Offline kevyn

  • Posts: 10
removing the /pages/ from the address
« on: February 16, 2010, 11:08:59 AM »
Hi there,

I tried searching around for the answer to my question but couldn't find anything.

Is it possible to have new pages created without the \pages\ folder being used?

I want:

www.mywebsite.com/page1

I don't want:

www.mywebsite.com/pages/pages1.html

thanks in advance :-)

WebBird

  • Guest

Offline kevyn

  • Posts: 10
Re: removing the /pages/ from the address
« Reply #2 on: February 16, 2010, 11:41:11 AM »
Thanks for that link, however I couldn't seem to make it work using those instructions - they don't appear to be tested anyway

I guess I'll have to wait for someone clever to make a plugin for it!

WebBird

  • Guest
Re: removing the /pages/ from the address
« Reply #3 on: February 16, 2010, 12:53:12 PM »
If you have an Apache webserver, just use MOD_REWRITE.

Edit: This works for me (Windows XP, Apache 2.2)

Code:
Only registered users can see contents. Please click here to Register or Login.
Replace RewriteBase with the path where the pages directory resides. The RewriteRule replaces all occurences of "anything but dot - dot - html" with "pages/<the part before the .html>.php"

Note: If a non existing page is entered, the "true" path will be shown in the error message. So you may want to add an error handler, too.

See http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

When clicking on a page link inside WB, the /pages/ directory will occur in the link, anyway.
« Last Edit: February 16, 2010, 01:28:20 PM by WebBird »

Offline kevyn

  • Posts: 10
Re: removing the /pages/ from the address
« Reply #4 on: February 16, 2010, 01:11:13 PM »
Thanks but I'm a php noob. I have used this from your previous link:

Code:
Only registered users can see contents. Please click here to Register or Login.
Which has made my links appear on the site as www.domain.com/test -however when you press on the link it cannot find the page.

I also added this to HTaccess:

Code:
Only registered users can see contents. Please click here to Register or Login.
however my problem still remains

WebBird

  • Guest
Re: removing the /pages/ from the address
« Reply #5 on: February 16, 2010, 01:26:10 PM »
With the above example (add to .htaccess in your WB directory) you won't have to change any php files.

Offline crnogorac081

  • Posts: 1852
  • Gender: Male
Re: removing the /pages/ from the address
« Reply #6 on: February 16, 2010, 02:05:06 PM »
does it work for all sub pages , for example: www.mzsite.xz/pages/sub/sublevel/sub_sub_level/this_page.php ?
no bb in signature

Offline kevyn

  • Posts: 10
Re: removing the /pages/ from the address
« Reply #7 on: February 16, 2010, 02:05:51 PM »
Well above is my htaccess file, and I have gone back to using the original php files - but I still have the long ugly URLs :-(

WebBird

  • Guest
Re: removing the /pages/ from the address
« Reply #8 on: February 16, 2010, 02:16:33 PM »
@crnogorac081: No, you will have to change the RewriteRule for this case.

@kevyn: When clicking on page links you have. Like I said. :-D

Offline Monky

  • Development Team
  • ****
  • Posts: 47
  • Gender: Male
    • Segelclub Würmsee Starnberg e.V.
Re: removing the /pages/ from the address
« Reply #9 on: February 16, 2010, 02:22:21 PM »
With the above example (add to .htaccess in your WB directory) you won't have to change any php files.
When you want the internal links inside your WB to be short too, you will have to change WB core files.

And I think he does not want .html extension either.

WebBird

  • Guest
Re: removing the /pages/ from the address
« Reply #10 on: February 16, 2010, 02:24:02 PM »
Aaah... you want to store the files at "WB installation root"? (Bad idea...) To do this, set the "pages directory" (Backend, Advanced settings) from "/pages" to "/". Be sure that you have NO pages before doing this!

After this change, all access files will be stored directly in the WB root dir. (But you really shouldn't do that...)

WebBird

  • Guest
Re: removing the /pages/ from the address
« Reply #11 on: February 16, 2010, 02:26:07 PM »
And I think he does not want .html extension either.

Would be better to use an extension, otherwise he will have to exclude all the WB subdirs (like "admin", "templates", "modules" etc.) from the MOD_REWRITE.

Offline Monky

  • Development Team
  • ****
  • Posts: 47
  • Gender: Male
    • Segelclub Würmsee Starnberg e.V.
Re: removing the /pages/ from the address
« Reply #12 on: February 16, 2010, 02:59:21 PM »
Aaah... you want to store the files at "WB installation root"? (Bad idea...)
I think it's OK for him to keep the /pages folder as long as it doesn't show up in the URLs.
But I'll quit the oracle job now =)

Offline crnogorac081

  • Posts: 1852
  • Gender: Male
Re: removing the /pages/ from the address
« Reply #13 on: February 16, 2010, 03:21:33 PM »
I stored my pages i root, and set root folder to 755.. I know it is not good, but since root has 755 I didnt have problems so far :)

But it would be nice to create some kind of .htaccess plugin (like a module which will upload .htaccess file to root and set up things :) )

Unfortunatelly, I had no experience and knowledge about .htaccess..  :cry:
no bb in signature

Offline kevyn

  • Posts: 10
Re: removing the /pages/ from the address
« Reply #14 on: February 16, 2010, 05:54:53 PM »
So would it be safe to simply change the pages directory to root?

also, what happens if I change the page extention to nothing? I assume changing it to .html or .php wouldn't be a problem, but what happens if you blank it out all together? (sorry if that's a silly question)

@WebBird - my htaccess file is the code in my older post, and even with that in place, all the links on my site show up as full URLs, and when you click them, they lead you to the complete URL

Offline bfuller

  • Posts: 16
Re: removing the /pages/ from the address
« Reply #15 on: February 16, 2010, 06:19:35 PM »
Kevyn

I think you might get some help from the following link.

http://zenverse.net/seo-friendly-urls-with-htaccess/

Hope it helps.

Bob

WebBird

  • Guest
Re: removing the /pages/ from the address
« Reply #16 on: February 16, 2010, 06:53:32 PM »
So would it be safe to simply change the pages directory to root?

No, as you will have to change the access rights to your WB root so that WB can write the files. (See above.) This is why it's a bad idea. ;)

also, what happens if I change the page extention to nothing?

The Web server will no longer execute the files as PHP, but show them as plain text. This is not what you're after. ;)

@WebBird - my htaccess file is the code in my older post, and even with that in place, all the links on my site show up as full URLs, and when you click them, they lead you to the complete URL

The .htaccess means that you can put something like

http://.../bla.html

into your browser address line and get the page

http://.../pages/bla.php

in return. So you can use short URLs in Mails etc. But WB itself will still use the "correct" (long) URLs in the nav menus etc. To change that, you will have to edit the Frontend class as you did above.

In any case, this is a very dirty hack (you will loose when upgrading WB to a newer version), so you may think about it again. ;) What's so bad with /pages/?

Offline crnogorac081

  • Posts: 1852
  • Gender: Male
Re: removing the /pages/ from the address
« Reply #17 on: February 17, 2010, 12:10:19 AM »
But it is safe to set pages in root, if you set 755 to root and all subfolders and files, right ?
no bb in signature

WebBird

  • Guest
Re: removing the /pages/ from the address
« Reply #18 on: February 17, 2010, 02:17:01 PM »
Define "safe".  :-D

chio

  • Guest
Re: removing the /pages/ from the address
« Reply #19 on: February 17, 2010, 04:45:21 PM »
If you save pages in the root, you will get troubles if you have pages like "modules" or "admin" with subpages. This might destroy your WebsiteBaker installation.

The easiest way is to use mod_rewrite AND of course you have to change all links on your websites:
in index.php after
Code:
Only registered users can see contents. Please click here to Register or Login.add
Code:
Only registered users can see contents. Please click here to Register or Login.(untested)


WebBird

  • Guest
Re: removing the /pages/ from the address
« Reply #20 on: February 17, 2010, 04:50:57 PM »
This is why I said that you would have to exlude this directory names from the list, using RewriteCond rules.

Offline sky writer

  • Posts: 875
Re: removing the /pages/ from the address
« Reply #21 on: February 20, 2010, 10:04:35 PM »
This thread has me worried.  I have about eight WB sites, and I have removed the /pages and just use root for all of my pages.  I have never run into any trouble.

Can someone explain the dangers, or possible issues?  And when you say, define "safe", exactly what do you mean?

Waldschwein

  • Guest
Re: removing the /pages/ from the address
« Reply #22 on: February 20, 2010, 10:35:11 PM »
This thread has me worried.  I have about eight WB sites, and I have removed the /pages and just use root for all of my pages.  I have never run into any trouble.

Can someone explain the dangers, or possible issues?  And when you say, define "safe", exactly what do you mean?

Hello!

Well, the WebsiteBaker site uses no /pages.  :-D *cough* Unsafe site... *cough*
No, some modules have problems with no /pages, e.g. you have to change something in the topics module, or you can get problems with the /posts of the normal News form.

But in fact, there are no real problems with not using /pages. Security issues - not really, besides you call a page with subpages on the root level templates, include, framework or media.  :wink:

Yours Michael

Offline Luisehahne

  • WebsiteBaker Org e.V.
  • **
  • Posts: 4037
  • Gender: Male
    • Webdesign und Entwicklung WebsiteBaker
Re: removing the /pages/ from the address
« Reply #23 on: February 20, 2010, 10:55:42 PM »
May be this is what you searching for?

http://www.websitebakers.com/pages/admin/admin-tools/shortlink.php

Dietmar
Eric T. Hansen, amerikanischer Buchautor „Nörgeln des Deutschen größte Lust"
Neues Unwort: Schnappatmung

Offline sky writer

  • Posts: 875
Re: removing the /pages/ from the address
« Reply #24 on: February 21, 2010, 01:45:33 AM »
Well, the WebsiteBaker site uses no /pages.  :-D *cough* Unsafe site... *cough*
No, some modules have problems with no /pages, e.g. you have to change something in the topics module, or you can get problems with the /posts of the normal News form.

But in fact, there are no real problems with not using /pages. Security issues - not really, besides you call a page with subpages on the root level templates, include, framework or media.  :wink:

Yours Michael


Thanks for the reply.  Sorry, but I think something is getting lost in translation.  Are you saying it is safe, or not safe.  I don't understand from your examples, whether you are saying it is a bad thing, or nothing to worry about.