We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

LG .htaccess Generator - seems like {ee:pages} and {ee:404} have stopped working with EE 1.6.9?

Development and Programming

Oxygen Smith's avatar
Oxygen Smith
120 posts
15 years ago
Oxygen Smith's avatar Oxygen Smith

Hey all,

I’ve been using .htaccess Generator without incident for a long time, but then custom Pages URLs stopped working.

I can of course get them working if I manually add the URLs to the .htaccess template file that Generator uses, after I create the Pages, but I’d like to not have the client have to do this. {ee:templates} continues to work.

The issue seems to be that {ee:pages} doesn’t properly ‘write in’ the pipe-delimited list of Pages URLs. We recently updated to version 1.6.9 of EE, and I know that in the Version Update Notes for 1.6.9, there is some talk about extensions that use methods for calling Pages’ URLs as requiring an update, since the storage method for pages has changed internally.

Getting {ee:404} to work is less of a priority for me, since that never changes on my site (and isn’t under the control of the client) and I can manually add it in if it ever does. But I’d really like to get {ee:pages} working to keep it all seamless for the client. Any ideas?

Here’s Leevi’s code that seems to deal with ee:pages (and ee:404) in .htaccess generator (lines 552-579):

// replace pages
        if(strpos($new_htaccess, "{ee:pages}") !== FALSE)
        {
            if(($pages = $PREFS->ini('site_pages')) !== FALSE)
            {
                $page_roots = array();

                foreach ($pages['uris'] as $page_id => $page_url)
                {
                    if(substr($page_url, 0, 1) == "/")
                    {
                        $page_url = substr(trim($page_url), 1);
                    }
                    $parts = explode("/", $page_url);
                    if(isset($parts[0]) === TRUE)
                    {
                        $page_roots[] = $parts[0];
                    }
                }
                $new_htaccess = str_replace("{ee:pages}", implode("|", array_unique($page_roots)), $new_htaccess);
            }
            else
            {
                $new_htaccess = str_replace("{ee:pages}", "", $new_htaccess);
            }
        }

        $new_htaccess = str_replace("{ee:404}", $PREFS->ini("site_404"), $new_htaccess);

Can anyone shed some light on how this code might not be working as intended with the new 1.6.9 Pages URL storage structure?

Cheers all.

R o B

       
GlobalGraphics's avatar
GlobalGraphics
36 posts
15 years ago
GlobalGraphics's avatar GlobalGraphics

Hi there,

I am also having the same issue,

Cheers, Gareth.

       
tidy's avatar
tidy
196 posts
15 years ago
tidy's avatar tidy

{ee:pages} broke for me too in EE 1.6.9 but {ee:404} is still working for me.

I have fixed the {ee:pages} issue for my install.

In the block of code Oxygen referenced above, modify a line (558 I think):

foreach ($pages[1]['uris'] as $page_id => $page_url)

The change is just to put [1] between $pages and [‘uris’]. This is because the pages array has got a new dimension in EE 1.6.9 to represent the site id. See info: http://expressionengine.com/docs/installation/version_notes_1.6.9.html

So this fix won’t work for MSM sites as is - you may just need an extra loop to go through the site ids in the array instead of just hard coding [1]. I’ve never used MSM myself.

Hopefully this fix will work for others - let me know if you find any issues with it.

       
Oxygen Smith's avatar
Oxygen Smith
120 posts
15 years ago
Oxygen Smith's avatar Oxygen Smith

Just made this change a few days ago and forgot to thank you! It’s working great again, tidy. Cheers.

       
SHERPA Global's avatar
SHERPA Global
33 posts
15 years ago
SHERPA Global's avatar SHERPA Global

Many thanks. This helped me out quite a bit.

       
Cohenspire's avatar
Cohenspire
3 posts
15 years ago
Cohenspire's avatar Cohenspire

Thank you so much. Just saved me some massive headaches.

       
ira42's avatar
ira42
167 posts
15 years ago
ira42's avatar ira42

Thanks to both Oxygen & tidy!

Just upgraded a borked the site pretty thoroughly. Found this thread and it fixed it right up!

I am also running MSM, and can confirm that the following works, as the site_id is already available to the extension:

foreach ($pages[$PREFS->ini('site_id')]['uris'] as $page_id => $page_url)

This will allow you to safely get this working for all of your MSM sites.

Cheers,

Ira

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
15 years ago
Leevi Graham's avatar Leevi Graham

Just noticed this thread thanks to an email from Ira. I’ve attached my current dev version of LG .htaccess generator which addresses the 1.6.9 update. Can you just do a quick test for me before I put it live.

       
Reusser Design, LLC's avatar
Reusser Design, LLC
58 posts
15 years ago
Reusser Design, LLC's avatar Reusser Design, LLC

I cannot get this new version to generate an .htaccess file, is anyone else having this issue?

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
15 years ago
Leevi Graham's avatar Leevi Graham

Any error messages?

       
Reusser Design, LLC's avatar
Reusser Design, LLC
58 posts
15 years ago
Reusser Design, LLC's avatar Reusser Design, LLC

Nope. In fact no messages at all. I have the right path, my .htaccess is chmod to 777. Nothing seems to be out of place. I’ve tried uninstalling the extension and reinstalling and still nothing.

       
Reusser Design, LLC's avatar
Reusser Design, LLC
58 posts
15 years ago
Reusser Design, LLC's avatar Reusser Design, LLC

Does LG .htaccess require any specific PHP settings? Could running EE on a subdomain matter?

       
Chad Crowell's avatar
Chad Crowell
242 posts
15 years ago
Chad Crowell's avatar Chad Crowell

Confirmed, Leevi that the update didn’t work. Well, it may work, but visually the extension settings screen isn’t showing up correctly. Small text box and bad styling.

       
Reusser Design, LLC's avatar
Reusser Design, LLC
58 posts
15 years ago
Reusser Design, LLC's avatar Reusser Design, LLC

I think the small text box and styling issues are because the newest version utilizes the Morphine add on Leevi created. I believe you can download it here: http://github.com/newism/nsm.morphine.theme (May be EE2 only)

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.