Welcome Guest, Not a member yet? Register   Sign In
Possible to have dashes for controller URIs?
#1

[eluser]Shpigford[/eluser]
So I want to have a URL like so:

http://example.com/system-management (where system-management ultimately routes to a controller named system-management.php)

Unfortunately I get a 404 error with that (assuming because my class name is SystemManagement).

Is there a way to have dashes in controller names?
#2

[eluser]Michael Wales[/eluser]
Using routing to have the URL with dashes point to the controller name without.
#3

[eluser]Shpigford[/eluser]
But how would I do that without having to create a route for every file?
#4

[eluser]dawnerd[/eluser]
It's best not to. I found a problem with php where functions with dashes cause problems.
#5

[eluser]omed habib[/eluser]
any luck with this? id like to see if there is a solution without having to create a route for every section of the site.
#6

[eluser]Eric Cope[/eluser]
is there a way of using an .htaccess file to strip a "-"?
#7

[eluser]Derek Jones[/eluser]
If you used a standard naming scheme, you could accomplish this with a half dozen or so routes using regular expressions. Though honestly, isn't the dash vs. underscore thing beaten to a pulp? Content is king, your URL separator is not going to make or break your search rankings.
#8

[eluser]Derek Jones[/eluser]
[quote author="Eric Cope" date="1215765896"]is there a way of using an .htaccess file to strip a "-"?[/quote]

Yep, that's another option, have the server do it, but that will be read and processed by Apache for every file request, which even if it ends up taking no action, is still wasteful for requests that don't get sent to CI.
#9

[eluser]Bramme[/eluser]
Can't you just use
$route['/system-management(.*)'] = '/SystemManagement$1';

as route, or am I missing something?
#10

[eluser]Eric Cope[/eluser]
[quote author="Derek Jones" date="1215766933"]If you used a standard naming scheme, you could accomplish this with a half dozen or so routes using regular expressions. Though honestly, isn't the dash vs. underscore thing beaten to a pulp? Content is king, your URL separator is not going to make or break your search rankings.[/quote]

I consider seo like building a house. Content is the foundation (without content, you are wasting your time). However the value of optimized urls is like having a nice remodeled bathroom when it comes time to sell. I would recommend using the half dozen routes Derek recommended. Every little bit helps.

SEO is about getting all of these bricks in order on your foundation to build a strong seo strategy. One of those bricks is a strong related url. To test this theory, google something and see how many results have the key words in the urls.

But, Derek is right. If you have no content, then there is no reason for anyone to visit in the first place.




Theme © iAndrew 2016 - Forum software by © MyBB