使用PHP CodeIgniter开始URL路由
我只是想路由我的网址,就像使用PHP CodeIgniter开始URL路由,php,codeigniter,url-routing,Php,Codeigniter,Url Routing,我只是想路由我的网址,就像 http://localhost/codeigniter_cup_myth/index.php/adminController/mainAccount 如果是的话,那就太好了 http://localhost/codeigniter_cup_myth/Accounts/mainAccount 在web应用程序中路由URL时,应从何处开始?路由的定义如下: $route['product/:num'] = "catalog/product_lookup"; 其中pro
http://localhost/codeigniter_cup_myth/index.php/adminController/mainAccount
如果是的话,那就太好了
http://localhost/codeigniter_cup_myth/Accounts/mainAccount
在web应用程序中路由URL时,应从何处开始?路由的定义如下:
$route['product/:num'] = "catalog/product_lookup";
其中product
/anynumber
是您的URL:。第二部分是控制器/方法。我们在这里讨论的URL将调用catalog controller的product_查找方法
$route['accounts/mainaccount'] = "adminController/mainAccount"
你要找的东西会被炒了。更多示例请查看CodeIgniter
我使用这个.htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
允许访问任何物理上存在的文件,所有其他文件都被路由到CI。路由定义如下:
$route['product/:num'] = "catalog/product_lookup";
其中product
/anynumber
是您的URL:。第二部分是控制器/方法。我们在这里讨论的URL将调用catalog controller的product_查找方法
$route['accounts/mainaccount'] = "adminController/mainAccount"
你要找的东西会被炒了。更多示例请查看CodeIgniter
我使用这个.htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
它允许访问任何物理上存在的文件,所有其他文件都被路由到CI。此外,还添加了如下内容:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
在.htaccess文件中,还将删除index.php部分,添加如下内容:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
到您的.htaccess文件将删除index.php部分您可以检查woo url路由组件 woo url路由功能:
你可以检查woo url路由组件 woo url路由功能: