well shuckers…hook a sister up with the instructions!
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
July 21, 2009 10:29pm
Subscribe [11]#16 / Jul 30, 2009 1:11pm
well shuckers…hook a sister up with the instructions!
#17 / Jul 30, 2009 1:13pm
In addition to this wiki entry:
http://expressionengine.com/wiki/Remove_index.php_From_URLs/
there are also a LOT of forum posts.
#18 / Jul 30, 2009 1:16pm
smokin!
#19 / Jul 30, 2009 3:59pm
You don’t necessarily have to use .htaccess to omit the template group. You could use URL segment variables and embed different templates depending on the URL segment.
{if segment_2 == ''}
{embed="site/home_page"}
{if:elseif segment_2 == 'archives'}
{embed="site/archives"}
{if:elseif segment_2 != ''}
{embed="site/web_page" url_title="{segment_2}"}
{/if}Another way would be to you run everything through a more complex main index template. See How Subtraction.com was converted to EE for one way to do it.
Personally, it seems like more trouble than it’s worth, and I’m not sure putting everything into one template was necessary to accomplish the site structure.
#20 / Jul 30, 2009 5:57pm
You don’t necessarily have to use .htaccess to omit the template group. You could use URL segment variables and embed different templates depending on the URL segment.
{if segment_2 == ''} {embed="site/home_page"} {if:elseif segment_2 == 'archives'} {embed="site/archives"} {if:elseif segment_2 != ''} {embed="site/web_page" url_title="{segment_2}"} {/if}Another way would be to you run everything through a more complex main index template. See How Subtraction.com was converted to EE for one way to do it.
Personally, it seems like more trouble than it’s worth, and I’m not sure putting everything into one template was necessary to accomplish the site structure.
Sorry to come in and ask a nOOb question, but I’ve been beating my head against this for over a week now. It looks like url segment variables is a much nicer way of removing the template group than .htaccess.
Here’s my issue: my site is all running under one template group (/jtspangler)—basically 6 static pages and a blog. I was able to ditch the index.php through .htaccess, no problem. But I can’t get rid of the template group. The way it currently works is each static page has its own template (jtspangler/index is the homepage, jtspangler/bio is the bio, etc.). That would seem to preclude using the url segment code from above, as it calls for embedded templates (which my content is not :/ ).
Can anyone explain (using small words 😉 ) how to use url segment variables to remove the template group from the url? Is this possible with the way I’m set up?
#21 / Aug 03, 2009 3:56am
About the only ‘people friendly’ URL is one that gets used in advertising (television, radio, print) with something like:
Obviously, that URL looks better on a TV commercial than:
http://www.mysite.com/index.php/marketing/july-promo-offer/
That’s easily handled with a redirect or the EE Pages module. There is no such thing as a ‘people friendly’ URL on a site because 99.99% of the time a user will simply point and click to get to a page, or copy and paste (what gets copied doesn’t matter much), rather than keystroke a link into a browser.
Don’t discount the usefulness of the ‘people friendly’ short URL combined with custom redirect rules in the .htaccess file. It’s enormously powerful, and solves a heck of a lot of problems for the webmaster.
#22 / Aug 06, 2009 4:55pm
Can anyone explain (using small words) how to use url segment variables to remove the template group from the url?
Set up a separate weblog for your web pages. Let’s call it “Web Pages” (with “web_pages” as the short name). Move your web pages into this weblog; they don’t need to be templates.
Set up a template to display the web pages (this would be the site/web_page template from my earlier example:
{exp:weblog:entries weblog="web_pages" url_title="{embed:url_title}"}
{title}
{body}
{/exp:weblog:entries}Let’s say you had an entry called “My Test Page” with “my-test-page” as the URL title, and went to http://www.example.com/my-test-page in your browser. “my-test-page” would be segment 2, and because segment 2 has a value and segment 2 isn’t “archives” EE would load the site/web_page template, with my-test-page as the url_title parameter. The site/web_page template would use the url_title to display the page.
#23 / Aug 06, 2009 7:30pm
Don’t discount the usefulness of the ‘people friendly’ short URL combined with custom redirect rules in the .htaccess file. It’s enormously powerful, and solves a heck of a lot of problems for the webmaster.
Very true. Also I have used directories and path.php edits to make a simple mydomain.com/directory/ URL display something that would otherwise be mydomain.com/directory/index.php/templategroup/template/url_title/.
Path.php—it’s everywhere you want it to be.
#24 / Feb 12, 2010 3:40am
I’m not sure putting everything into one template was necessary to accomplish the site structure.
To be sure, it wasn’t necessary—there’s always more than one way to do it—but I did it that way because I thought it was indeed the simplest in the long run, the cleanest and easiest to maintain.