Thanks for the feedback, let me break this down somewhat. Firstly we have the server aspect of the URL you're using, namely /~Streel/EE_Site
This part of your URL is clearly routing to a folder in your home directory, if this part is not working this is a server configuration issue and is technichally out of scope of this StackExchange (but we'll help where we can!).
The next part will be the EE Path, here Shop/Test
are broken down into 2 segments, as per the EE docs, without any special routes ( Docs : Template Routes ) these segments map to Template Group / Template Name
. This isn't what you're after though! What you want is Channel/entry_url_title
.
Note : You may wish to check out how EE uses Dynamic Parameters as well, might get you there quicker! however for completeness...
Note : from here on in I'm assuming your E version is > 2.9.3 so you have template routes!
No problem though, with the EE router we can set up a route on a template to handle this. For example lets set up a template in the Group called Site
and a template called EntryDisplay
.
Now lets edit the template and set the route. Here we go to the bottom, open up the "Access" section and in the "Template Route" field enter :
{desired_channel:alpha_dash}/{desired_entry:alpha_dash}
Also, Make sure 'Require All Segments' is set to 'Yes'. What we've done here is say if we have 2 segments (Shop and Test) and both are alpha_dash valid, use this template. Of course tyou'll have to review the routing table in Design -> Templates -> Template Route Manager
to ensure this route is the last on in the list, or it'll try to handle all your 2 segment URLS!
Now for the template itself, on the template your segment/route variables are turned into standard EE variables ( so {segment:desired_channel}
& {segment:desired_entry}
), we can feed these into the good old EE Channel Entries tag as so :
{exp:channel:entries channel="{segment:desired_channel}" url_title="{segment:desired_entry}" dynamic="no"}
<h1>{title}</h1>
{!-- here we send to 404 land if there's no entry for the URL supplied! --}
{if no_results} {redirect="404"} {/if}
{/exp:channel:entries}
Answer to Edit 1
Thanks for the further info, just looking at the code (I have a sandbox test set up) I can see 2 things that might be going wrong.
First is if you aren't getting your template displayed at /shop/
, if the template group this is in is not called Shop this will never work, however you can re-use what we learned about routing above, simply set your template route to Shop
and thats it! You should get your template appearing at /~Streel/EE_Site/Shop
Second is potentually the output of url_title_path
is not correct. Really I'd need to see the output however I spunthis up on my local and essentually what it does is output {base_url} / {param1(shop)} / {url_title}
Therefore if the path before /shop/ is incorrect, please review your URL to the root directory of your site
setting in Admin ->General Configuration
, this should be 'localhost/~Streel/EE_Site'. If its the following parts, perhaps you can let us know the template group, template name and router setting so we can diagnose further...
Edit 2
Following investigation it appears the probelm was in fact using friendly URL's without having them set up. It seems the templates work fine when CStreel uses non freindly URL's i.e.
/~Streel/EE_Site/index.php/Shop/test
For info on setting up Freindly URL's, we refer again tothe EE docs : https://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html
Here's my working example, it uses a whitelist principle so for any paths you wish to exclude from the friendly URL handling (apart from files and directories see inline comments) add them to the final 2 RewriteCond's :
# Enable Rewrite Engine
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Exclude file paths
RewriteCond %{REQUEST_FILENAME} !-f
#Exclude directory paths
RewriteCond %{REQUEST_FILENAME} !-d
#Cant rcall what this excludes, Pagination maybe??
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
#Specific files to exclude
RewriteCond $1 !^(favicon\.ico|index\.php|path\.php|php\.ini|admin\.php) [NC]
#Specific directories to exclude (bpath begins with)
RewriteCond $1 !^(system|sysbase|images|themescss|assets)/ [NC]
#If the current request is not excluded, insert the index.php
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
Finally, in order for EE to produce friendly url's from your tags, make sure to goto Admin -> General Preferences
and set Name of your site's index page
to '' (blank)
/home/Streel
and that in there tyou have a directory with your site in it (EE_Site), and further from thereShop/Test
are your 'channel/entry'? In EEShop/Test
means look for a template calledTest
in the template groupShop
, unless you have a specific route set up (if you do could you share?)/~Streel/EE_Site/
work, you get your homepage/index??