PHP中的双URL重写

PHP中的双URL重写,php,.htaccess,mod-rewrite,url-rewriting,Php,.htaccess,Mod Rewrite,Url Rewriting,你好,我是新手,如果我以错误的方式提问,请提前道歉 我正在使用CodeIgniter框架……我陷入了URL重写 假设example.com是我的网站…..URL重写在example.com中起作用/(此处URL重写起作用) 比如说 example.com/2014_12_12--->>link to page with data example.com/2014_12_15--->> link to page with data (Note its done with u

你好,我是新手,如果我以错误的方式提问,请提前道歉

我正在使用CodeIgniter框架……我陷入了URL重写

假设example.com是我的网站…..URL重写在example.com中起作用/(此处URL重写起作用)

比如说

example.com/2014_12_12--->>link to page with data
example.com/2014_12_15--->> link to page with data
(Note its done with url rewrite and it is working fine)
现在我想用一些文本修改我的URL…就像那样

example.com/2014_12_12--->>link to -->>example.com/random text from array/2014_12_12
随机文本,我想把它只是为了优化/搜索引擎优化的目的,它没有数据链接

可能吗?我很感激:-)

很抱歉给您带来不便

  • 在application/config.php文件中进行以下更改

    $config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/Your Ci folder_name';
    $config['index_page'] = '';
    $config['uri_protocol'] = 'AUTO';
    
  • 使用下面的代码在根目录中创建.htacces文件

    RewriteEngine on
    RewriteCond $1 !^(index\.php|resources|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
    

  • 你能解释一下$1,robots\.txt的功能吗