admin管理员组文章数量:1123849
Does anyone know how I can get rid of index.php in my URL? Right now if I add a new page, the address will be:
www.mywebsite/index.php/page1
But I want it to be:
wwww.mywebsite/page1
I surfed the web a lot! Changing the permalink doesn't work. Does anyone know how I can fix this?
Does anyone know how I can get rid of index.php in my URL? Right now if I add a new page, the address will be:
www.mywebsite.com/index.php/page1
But I want it to be:
wwww.mywebsite.com/page1
I surfed the web a lot! Changing the permalink doesn't work. Does anyone know how I can fix this?
Share Improve this question edited Mar 25, 2017 at 9:32 geek2000 asked Mar 23, 2017 at 9:30 geek2000geek2000 1132 silver badges7 bronze badges4 Answers
Reset to default 4This is a classical case. All you need to do is to use Rewrite Rules. With Apache, you can do it in .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
More on this in codex.
first try to change the permalinks in general setting of you website dashboard.....if not then you have to edit your .htaccess file....hope this will help to resolve the issue..!!
I was also a victim of this error.But Now have solved the issue in CWP permalink index.php remove solution as follow:
Create a .htacess file in the root directory of your website /public_html/yoursite.com
Write the following code in it
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
then Goto wp-admin >>> settings >>> permalinks
Select "Custom Structure" and remove "index.php" only from it
Save and check ... It works perfectly!
thanks at all
I will extend the correct answer.
If you're using Apache webserver
1. First check on the Wordpress admin panel in Setting/Permalinks if you selected the desired way to show links.
2. Check if the file .htaccess on the DocumentRoot folder of your virtualhost has this code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
3. Check if in the Apache VirtualHost config you have correctly setup the AllowOverride
option
It will work with AllowOverride All
or AllowOverride FileInfo All
3. Check if the mod_rewrite module it's enabled in your Apache config
4. ¿Using FPM/FastCgi/Cgi PHP interpreter?
If you're using the PHP module of Apache you should be ok. But if you're using FPM/FastCgi/Cgi you should do this because Wordpress tries to detect if the mod_rewrite module it's enabled on Apache. But if you're not using the apache module that function wordpress uses returns nothing and it will think you don't have the mod_rewrite enabled.
So you should need to fake one function inside the functions.php of your theme. I suggest you to use a child-theme of your theme to avoid problems when updating.
You should add this code to the functions.php of your theme usually (wp-content/themes/<your_theme>/functions.php
add_filter('got_url_rewrite', 'enable_url_rewrite');
function enable_url_rewrite($got_url_rewrite) {
return true;
}
If you're using Nginx
Check if you have a similar code inside the virtualhost. If not add it.
# if requested file doesn't exists, send to bootstrap
if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}
With nginx it will finish here, but if you continue to get problems check the last item of the Apache section.
本文标签: permalinksHow to get rid of indexphp
版权声明:本文标题:permalinks - How to get rid of index.php? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736600065a1945203.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论