i am using wordpress permalink like url.com/article-name but i dont want errors 404 handled by my page - so redirected to the normal server error page.
I am using the following .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
Can someone help me how i have to adjust the .htaccess code that a error is not redirected to the index.php. If i deleted the .htaccess any links redirects to the server error 404 page.
thank you
Just add this
ErrorDocument 404 /404.php
# where 404.php is your error page
According to this answer at https://wordpress.stackexchange.com/ you should use
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(robots\.txt|sitemap\.xml(\.gz)?)
RewriteCond %{REQUEST_FILENAME} \.(css|js|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ [NC]
RewriteRule .* - [L]
</IfModule>
Hope it helps!
Related
The home page of my wordpress website seems to be wroking correctly but if you click through to any of the other pages I get the following error message:
The requested URL /about was not found on this server.
There is following htaccess code in the permalink setting:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
This is the URL of my website http://www.harimaumalaysia.my/ when i access through this url i can see my website with out error.
but when i use this URL http://www.harimaumalaysia.my/index.php Its redirecting to this URL www.harimaumalaysia.my/demo1.
how come this is happening while using index.php I changed my website url in database and permalinks but it didn't solved my problem can anyone help me out of this here is my ht-access file.
# 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
Set rewrite rule for index file like below.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(css|editor|editordocs|images|js|sysimgdocs)/.*$ - [PT]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</IfModule>
first of all I know there are questions about my problem I tried few of them, but unsuccessfully.
I am trying to get:
http://example.com/project/text
from
http://example.com/projects.php?c=text
I have this .htaccess:
RewriteEngine on
RewriteRule ^project/(.*)$ projects.php?c=$1 [L,QSA]
ErrorDocument 404 404.php
When I open the site i.e. http://example.com/project/123456 I get nothing(Blank site).
Thank you for you help.
You can try:
ErrorDocument 404 404.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^project/(.+)$ projects.php?c=$1 [L,QSA,NC]
I'm having some issues with a Codeigniter app in a subfolder on my server along with a Wordpress install in the document root. If I hide the index.php of the Codeigniter URL with .htaccess
/codeigniter/.htaccess
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|user_guide|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
And get Wordpress to ignore /codeigniter with RewriteCond %{REQUEST_URI} !^/(codeigniter).*$
/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/(codeigniter).*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Then navigate to www.mysite.com/codeigniter/my_controller/my_function, I get a 404 error No input file specified. I found here, that adding a ? after RewriteRule ^(.*)$ index.php solves the Codeiginiter 404 error.
/codeigniter/.htaccess
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
However I'm now getting a Wordpress 404 error, so it seems if I replace index.php with index.php? in /codeigniter/.htaccess, the Wordpress rewrite rule in /.htaccess, RewriteCond %{REQUEST_URI} !^/(codeigniter).*$ gets ignored. Is there a better way to handle this?
Thanks in advance!
The RewriteBase in the codeigniter directory should say /codeigniter/
RewriteBase /codeigniter
Otherwise the rewrite to index.php ends up going to wordpress' router.
Can we rewrite WordPress page /ghij to show the contents of page /faq, when permalinks are already enabled?
My page is example.com?page_id=70&category=Footage. After enabling permalink it is showing example.com/video-category?category=Footage. I want it to look like example.com/category/Footage.
Any help in this will be appreciated.
Current .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^page_id=([0-9]*)&category=(.*)$
RewriteRule ^(.*)$ /%1/%2? [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Works. And redirects from:
http://test.com/index.php?page_id=70&category=Footage
To:
http://test.com/70/Footage
UPDATED:
RewriteRule ^(.*)/(.*)$ /index.php?page_id=$1&category=$2 [L]
This rule Works and makes inner redirect (without url change) from:
http://test.com/70/Footage
To:
http://test.com/index.php?page_id=70&category=Footage
i hope the following plugin will help you more
http://wordpress.org/extend/plugins/permalink-editor/
please check this plugin it will rewrite the permalink as you want without any coding knowledge.