[Solved] .htaccess Editing..?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
EGS
Forum Members
Forum Members
Posts: 66
Joined: Sat Apr 28, 2007 4:25 am

[Solved] .htaccess Editing..?

Post by EGS »

Hello.

I was wondering if I can delete part of the .htaccess out without losing any of my site's functionality?
I want to delete the following out:

Code: Select all

RewriteRule ^(.+)$ index.php?page=$1 [QSA]
I am using page hierarchy system, so my site's URLs are like www.site.com/page/ and site.com/page/subpage/ etc...
Is it safe to delete that code out or will it mess it all up?

Reason I am asking is because I need to do 301 redirects it's adding the "?=page-file-being-redirected" to my URLs...

ie, 301 redirect site-page.html to site-page/ becomes site-page/?page=site-page :(
Last edited by Anonymous on Sun Jun 29, 2008 6:29 pm, edited 1 time in total.
EGS provides MMORPG services for WoW, FFXI, FFXIV, AION, Warhammer Online, Age of Conan, RuneScape, Guild Wars, Maple Story, Cabal Online, as well as most other free-to-play MMORPGs.

Our site is *proudly* powered by CMS Made Simple. :D

CMS Made Simple isn't just simply, it's ridiculously powerful, and suitable for virtually any site and niche. It easily allows us to maintain our site in which receives about 5,000 unique visitors per day.
EGS
Forum Members
Forum Members
Posts: 66
Joined: Sat Apr 28, 2007 4:25 am

Re: .htaccess Editing..?

Post by EGS »

Also why is it that every page like site.com/mydirectory/subdirectory can also be accessed if you just plug "subdirectory" in for the "mydirectory"

ie, site.com/page-cat/sub-page can be accessed at site.com/sub-page as well...this is really bothering me because this can be considered duplicate content when it's the same page for some reason..
EGS provides MMORPG services for WoW, FFXI, FFXIV, AION, Warhammer Online, Age of Conan, RuneScape, Guild Wars, Maple Story, Cabal Online, as well as most other free-to-play MMORPGs.

Our site is *proudly* powered by CMS Made Simple. :D

CMS Made Simple isn't just simply, it's ridiculously powerful, and suitable for virtually any site and niche. It easily allows us to maintain our site in which receives about 5,000 unique visitors per day.
EGS
Forum Members
Forum Members
Posts: 66
Joined: Sat Apr 28, 2007 4:25 am

Re: .htaccess Editing..?

Post by EGS »

No answers huh!
EGS provides MMORPG services for WoW, FFXI, FFXIV, AION, Warhammer Online, Age of Conan, RuneScape, Guild Wars, Maple Story, Cabal Online, as well as most other free-to-play MMORPGs.

Our site is *proudly* powered by CMS Made Simple. :D

CMS Made Simple isn't just simply, it's ridiculously powerful, and suitable for virtually any site and niche. It easily allows us to maintain our site in which receives about 5,000 unique visitors per day.
Pierre M.

Re: .htaccess Editing..?

Post by Pierre M. »

Hello,

I'm a bit confused by all your statements and questions, "because" and "ie". Sorry, I'm not a native English speaker. Could you please simplify your question ?
What do you have ? What do you want ? What have you tried so far ? What is good/bad/reproducible/else ?
Thanks

Pierre M.
Wiedmann
Forum Members
Forum Members
Posts: 233
Joined: Wed Mar 26, 2008 1:49 am

Re: .htaccess Editing..?

Post by Wiedmann »

King Justice wrote:I want to delete the following out:

Code: Select all

RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Is it safe to delete that code out or will it mess it all up?
No, that's THE important rule, which is doing the necessary rewrite job for pretty urls.
Pierre M. wrote:What do you have ? What do you want ? What have you tried so far ? What is good/bad/reproducible/else ?
e.g. you have these settings in your "config.pgp":

Code: Select all

$config['assume_mod_rewrite'] = true;
$config['page_extension'] = '/';
$config['use_hierarchy'] = true;
you can access access the same page with different URI's:
1) http://example.com/extensions/modules/
2) http://example.com/modules/
3) http://example.com/index.php/extensions/modules/
4) http://example.com/index.php/modules/
5) http://example.com/index.php?page=modules

But only the first one should be valid and working for this configuration (Especially the second one should not word).
EGS
Forum Members
Forum Members
Posts: 66
Joined: Sat Apr 28, 2007 4:25 am

Re: .htaccess Editing..?

Post by EGS »

Wiedmann wrote:
King Justice wrote:I want to delete the following out:

Code: Select all

RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Is it safe to delete that code out or will it mess it all up?
No, that's THE important rule, which is doing the necessary rewrite job for pretty urls.
Pierre M. wrote:What do you have ? What do you want ? What have you tried so far ? What is good/bad/reproducible/else ?
e.g. you have these settings in your "config.pgp":

Code: Select all

$config['assume_mod_rewrite'] = true;
$config['page_extension'] = '/';
$config['use_hierarchy'] = true;
you can access access the same page with different URI's:
1) http://example.com/extensions/modules/
2) http://example.com/modules/
3) http://example.com/index.php/extensions/modules/
4) http://example.com/index.php/modules/
5) http://example.com/index.php?page=modules

But only the first one should be valid and working for this configuration (Especially the second one should not word).


I am using page hierarchy to make my site's URLs look like site.com/cat/sub
The sub part of the url can also be accessed just by going to site.com/sub directly..

I want it to HAVE to have the parent category in the url to work..
Only site.com/cat/sub should work, site.com/sub shouldn't also work because that flags a dup. content penalty with Google if anyone finds it..
EGS provides MMORPG services for WoW, FFXI, FFXIV, AION, Warhammer Online, Age of Conan, RuneScape, Guild Wars, Maple Story, Cabal Online, as well as most other free-to-play MMORPGs.

Our site is *proudly* powered by CMS Made Simple. :D

CMS Made Simple isn't just simply, it's ridiculously powerful, and suitable for virtually any site and niche. It easily allows us to maintain our site in which receives about 5,000 unique visitors per day.
User avatar
tinhat
Forum Members
Forum Members
Posts: 65
Joined: Fri May 23, 2008 6:33 am

Re: .htaccess Editing..?

Post by tinhat »

Because I am curious I tested out using mod_rewrite rules to do the redirects you require. Here is an example:

RewriteCond %{REQUEST_URI} /page/subpage.html
RewriteRule .* /page.html [R=301,L]

Or is what you want the other way around? I don't know. If you give an example of the redirct you want I can tell you the exact rewrite rules.

Note these directives should be below the
RewriteEngine On directive
but before the other rewrite directives that do the pretty url stuff.

If you want to use mod_rewrite you really should read and learn the documentation at the apache website. mod_rewrite is one brilliant apache module that every web developer should learn IMHO.

Regarding your SEO issue of the duplicate urls. I take SEO very seriously but I would not be too concerned over this. Google will only consider it duplicate content if it *finds* multiple urls to the same content via links on the web. In practice this should not happen unless for some reason someone finds and then links to the shorter url. It shouldn't appear in any of the links on your site or your sitemap right?

If you are still concerned about this then perhaps turn the use_hierarchy to false in config.php but this will mean that pretty urls is not enabled for modules such as news.
EGS
Forum Members
Forum Members
Posts: 66
Joined: Sat Apr 28, 2007 4:25 am

Re: .htaccess Editing..?

Post by EGS »

Hello, you're not understanding me right..

I am using the page hierarchy system in CMSMS for categories and subcategories - to categorize the content within my site.
I also have Pretty URLs enabled..so my site will look like www.site.com/categories and www.site.com/categories/page-within-that category/

Problem is that the "page-within-that-category" can be accessed via the root directory as well as the designated category directory. I want pages to only be accessed through the category in which it is assigned, not both the root directory and category.

I am having the problem of URLs/pages being accessible through both URL types:
www.site.com/page-within-that-subcategory
www.site.com/category/page-within-that-category

Both URLs will bring visitors to the same page, which ultimately SHOULD be www.site.com/category/page-within-that-category URL...
EGS provides MMORPG services for WoW, FFXI, FFXIV, AION, Warhammer Online, Age of Conan, RuneScape, Guild Wars, Maple Story, Cabal Online, as well as most other free-to-play MMORPGs.

Our site is *proudly* powered by CMS Made Simple. :D

CMS Made Simple isn't just simply, it's ridiculously powerful, and suitable for virtually any site and niche. It easily allows us to maintain our site in which receives about 5,000 unique visitors per day.
User avatar
tinhat
Forum Members
Forum Members
Posts: 65
Joined: Fri May 23, 2008 6:33 am

Re: .htaccess Editing..?

Post by tinhat »

The option I can think of is to hand code a series of paired rewritecond/rewriterule as per my example above:

RewriteCond %{REQUEST_URI} ^/page-within-that-subcategory
RewriteRule .* /category/page-within-that-subcategory [R=301,L]

You would have to hand code a pair for every page that belongs in a category. Not very practical.

The CMSMS engine is only interested in the last part of the URL - the substring which appears after the last "/" in the request URI which it uses to find a matching content alias in the database to match to the id of a page in the database.

You can have anything in the string that precedes the content alias and the url will still work. Example:

/random/foo/bar/subpage.html

Will still find subpage.html even though 'random'. 'foo' and 'bar' are just random stuff in the URL - not actual categories/subcateogries of your site structure.

There is nothing you can do about this. As I mentioned in my previous post, I don't think this is worth worrying about too much from a SEO perspective. How likely is it that someone is going to create a link to your content which is not the correct URL? Internally within your site the CMS will generate hierarchical URLs correctly.
Pierre M.

Re: .htaccess Editing..?

Post by Pierre M. »

King Justice wrote: I am using page hierarchy to make my site's URLs look like site.com/cat/sub
The sub part of the url can also be accessed just by going to site.com/sub directly..

I want it to HAVE to have the parent category in the url to work..
Only site.com/cat/sub should work, site.com/sub shouldn't also work because that flags a dup. content penalty with Google if anyone finds it..
I understand and I agree about the duplicate content fear.
This is a known 'bugfeature' of CMSms<2. Some (you and me) say it is a path bug, some say it is a short alias feature. May be allready filled in the forge, I don't remember.

Pierre M.
EGS
Forum Members
Forum Members
Posts: 66
Joined: Sat Apr 28, 2007 4:25 am

Re: .htaccess Editing..?

Post by EGS »

Pierre M. wrote:
King Justice wrote: I am using page hierarchy to make my site's URLs look like site.com/cat/sub
The sub part of the url can also be accessed just by going to site.com/sub directly..

I want it to HAVE to have the parent category in the url to work..
Only site.com/cat/sub should work, site.com/sub shouldn't also work because that flags a dup. content penalty with Google if anyone finds it..
I understand and I agree about the duplicate content fear.
This is a known 'bugfeature' of CMSms<2. Some (you and me) say it is a path bug, some say it is a short alias feature. May be allready filled in the forge, I don't remember.

Pierre M.
I would definitely like this bug fixed in the 1.2.x series. :( It doesn't seem to be too difficult.. :(
EGS provides MMORPG services for WoW, FFXI, FFXIV, AION, Warhammer Online, Age of Conan, RuneScape, Guild Wars, Maple Story, Cabal Online, as well as most other free-to-play MMORPGs.

Our site is *proudly* powered by CMS Made Simple. :D

CMS Made Simple isn't just simply, it's ridiculously powerful, and suitable for virtually any site and niche. It easily allows us to maintain our site in which receives about 5,000 unique visitors per day.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: .htaccess Editing..?

Post by calguy1000 »

in CMS 2.0 the hierarchy stuff will be automatic, but we probably won't do anything with the 1.x series because of the potential for complication with existing sites, and with existing modules.

I don't view it as a bug, it'd only be duplicate content IMHO if you had links going to both mysite.com/parent/child and mysite.com/child,  and CMS does prevent against that usually using the wysiwyg editors or the normal plugins.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “CMSMS Core”