I get that error when i upload my website to host and try to go on blabla.com/admin/ but on my xampp everything is working fine...any help? This is my .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Related
My .htaccess is so simple and it is already working fine in another server, but I have problem with my 1and1 server. if I call a pdf file from my server, both RewriteCond is not working at all.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?load=$1 [QSA,L]
Thanks in advance.
I was wondering if it's possible to redirect all requests to files/directories that do not exist to index.php, and after that clean the url.
So when I go to www.example.com/test/1 I want it to be redirected (rewrote?) to www.example.com
I tried the following and it does correctly load index.php, but it still says www.example.com/test/1 in the URL bar...
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
Of course I still want my css and js to load properly...
Try this. If I understand, you want to use this as a way of redirecting a 404 not found?
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [R=301,L]
Or maybe this without index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ / [R=301,L]
i want to rewrite url using .htaccess file,
my all data is saved in work folder on server
and i want to show that folder when user enter the complete webaddress
www.example.com to www.example.com/work using mod_rewrite
my code is
RewriteRule ^(.*)$ /work/$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
this code create problem when i enter somthing like www.example.com/folder/ than it externally redirect me to www.example.com/work/folder/ and shows 404 page not found even when work contains that folder and that folder contain index.php
Try this :
RewriteCond %{REQUEST_URI} !^/?work/
RewriteRule ^(.*)$ /work/$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ $1.php [NC,L]
I am using codeigniter. I have front end application and backend application like
/system/
/application/
/front/
/admin/
index.php
admin.php
.htaccess
I want my url like http://example.com/news/article1 (for site)
http://example.com/news/admin (for admin)
In .htaccess I have written
RewriteEngine On
# If the user types just "admin".
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/admin$ admin\.php [L,QSA]
# If the user enter in any admin section, like "admin/section".
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/admin\/(.*)$ admin\.php/$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
the front end is working fine but when I enter mydomain.com/admin it is throwing 404 not found error. Please help me.
Thanks and regards
I'm not that good with .htaccess, but from the CI website, you can use this for your .htaccess rule
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
and then use routes to rewrite your urls. Much easier than trying to do it in .htaccess files
Need help with .htaccess
I have website on my localhost with this .htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ website/index.php/$1 [L]
Now i want to move the site to subdomain.domain.com
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://subdomain.domain.com/index.php/$1 [L]
I chaged the url but this doesn'n work maybe because this is subdomain i don't know
hosting details:
# Subdomain Name Path [?]
1 subdomain.domain.com /home/www/subdomain.domain.com
my urls are like this
http://website/index.php/contact
with this htaccess i can use
http://website/contact
When i moved the site to the subdomain i can use http://subdomain.website/index.php/contact but when try http://subdomain.website/contact gives me error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Try with this one, it should work for all domains localhost as well as server.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
Make sure "rewrite_engine = on" on server.