Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/474.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript angular.js中用户友好的SEO_Javascript_Html_Angularjs_.htaccess - Fatal编程技术网

Javascript angular.js中用户友好的SEO

Javascript angular.js中用户友好的SEO,javascript,html,angularjs,.htaccess,Javascript,Html,Angularjs,.htaccess,我可以从url中删除#,但当页面重新加载时,它会转到404 我已将此添加到app.js: if (window.history && window.history.pushState) { $locationProvider.html5Mode(true); } 这是index.html <base href="/lawyer/"> 那么,你的问题是什么?仍然无法使URL变得用户友好?当我刷新页面时,它仍然会转到404。你的URL现在怎么样了?你希望他们怎

我可以从url中删除#,但当页面重新加载时,它会转到404 我已将此添加到app.js:

if (window.history && window.history.pushState) {
    $locationProvider.html5Mode(true);
}
这是index.html

<base href="/lawyer/">

那么,你的问题是什么?仍然无法使URL变得用户友好?当我刷新页面时,它仍然会转到404。你的URL现在怎么样了?你希望他们怎么样?这将非常有助于找到一个解决方案……现在它们是:localhost/myproject/#/home,我希望它们是localhost/myproject/home。您阅读、理解并实现了吗?
RewriteEngine   On
RewriteBase     /
RewriteCond     %{REQUEST_URI}          
!^(/index\.php|/img|/js|/css|/robots\.txt|/favicon\.ico)
RewriteCond     %{REQUEST_FILENAME} !-f
RewriteCond     %{REQUEST_FILENAME} !-d
RewriteRule     .               /index.html              [L]