I have a website which opens to /resources/Installer/index.php but the path I need it to open to is /Installer/index.php. I have asked my webhost to help but they have said they cannot help.
I have amended my .htaccess code to
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
and now I get an error message Error 404 - Not found Your browser can't find the document corresponding to the URL you typed in.
Related
Im trying to add a simple rewrite rule so that any request sent to /api/v1/ will be processed by /api/v1/api.php
Currently it does a 404 on my when I try and run the example method /api/v1/example
Im following this tutorial but little confused where to put my rewrite rule in my current htaccess file.
What I have so far in my htaccess file is:
# 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]
RewriteRule ^api/v1/(.*)$ api/v1/api.php?request=$1 [QSA,NC,L] # 404
</IfModule>
# END WordPress
Ive tried the wordpress method but that doesn't work either
add_rewrite_rule('^api/v1/(.*)$','api/v1/api.php?request=$1','top');
any help would be greatly appreciated.
Cheers :)
I'm doing similar - so in my /path/to/doc/root/api/v1/.htaccess I have
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /api/v1/index.php [L]
This ONLY catches requests in the /api/v1/ directory or lower, so the rest of my stuff still generates normal 404 errors, etc.
When my website was inside the root directory of my hosting, everything works find. However, I had to move my website files to a subdirectory.
Old:
/www/*
Current:
/www/websites/example
Now, I can visit the homepage of my website, but I get error when I visit other pages of my site.
example.com/1234/title_of_url -> example.com/index.php?qa-rewrite=1234/title_of_url
But when I visit that sample page, i get the following error.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator and inform them of the time the error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Here is my .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
Note: I have moved the file to my /www/ dir and it works fine. So I think I am missing to put websites/example somewhere in my .htaccess
Use this rule in site root .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/websites/ [NC]
RewriteRule .* websites/example/$0 [L]
Then use this code in websites/example/.htaccess:
RewriteEngine On
RewriteBase /websites/example/
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(?!index\.php$).*$ index.php?qa-rewrite=$0 [NC,L,QSA]
Hi i have this folder on my server and it is clients/nannyshareaustralia and im using a codeigniter framework i already set up the config.php in the base url too. And im adding also for the htaccess file
RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|images|js|assets|css)
RewriteRule ^(.*)$ /clients/nannyshareaustralia/index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /clients/nannyshareaustralia/index.php?/$1 [L]
and when i run it to the browser this is what it goes
Forbidden
You don't have permission to access /clients/nannyshareaustralia on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
can someone help me figured this out? Any help is muchly appreciated
Please try this Following code write in your .htaccess file
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
RewriteEngine On
RewriteBase /clients/nannyshareaustralia
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|images|js|assets|css)
....
Added a RewriteBase rule to your .htaccess granting that mod_rewrite is enabled on your server.
note
If you access the directory like www.domain.com/clients/nannyshareaustralia you must add a RewriteBase to the .htaccess
But if a url/domain is pointed at the folder clients/nannyshareaustralia there is no need for the RewriteBase.
I am trying to create a user management system where users can register another users using their pre-created user links such as http www .abc .co. uk/access/register.php?id=username [sorry not allowing to put more links]
but I want the long link to be like this:
http://www.abc.co.uk/username
and when users type the short url it will re-direct to http://www.abc.co.uk/access/register.php?id=username
Below are the codes in my .htaccess file at the moment as I am also running a wordpress in the same domain.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(\w+)$ ./access/register.php?id=$1 [L,QSA]
Can the .htaccess additional codes that I have added for the username redirect be used along with other wordpress redirect in the same .htaccess file?
When I type the short url in the browser it takes me to a "page not found" page.
I have tried several ways and the above codes does not work. Could anyone please help me? Thanks
Jay
What you want is not possible. How could apache differentiate between wordpress pages and usernames?
www.abc.co.uk/contact could be your contact site or the user “contact”. You need to put your referrer urls in a subfolder, eg. register (so you get abc.co.uk/register/username:
RewriteEngine On
RewriteBase /
# Register
RewriteRule ^/register/(.+)$ ./access/register.php?id=$1 [L,QSA]
# Wordpress
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
I want a redirect using htaccess I have a post name wordpressurl/curious and also a folder named curious
What I want is if a user tries to access
wordpressurl/curious
wordpressurl/curious/
wordpressurl/curious/subfolder
note trailing slash in 1 and 2 and 3 is subdirectory. All of them should give 404 error wordpress page using htaccess only
Edited
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Wordpress_Work/realestate/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /Wordpress_Work/realestate/index.php [L]
</IfModule>
# END WordPress
You can access the wordpress post that is the same as a curious directory by making the changes indicated below. Change curious to whatever your actual directory/post is.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Wordpress_Work/realestate/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
#add an OR
RewriteCond %{REQUEST_FILENAME} !-d [OR]
#OR if the URI is curious or curious/ or curious/subfolder
RewriteCond %{REQUEST_URI} ^/Wordpress_Work/realestate/curious(/.*)?$
RewriteRule . /Wordpress_Work/realestate/index.php [L]
</IfModule>
If you are putting RewriteCond %{REQUEST_FILENAME} !-d you can't have same name for the page and physical directory . that's the point of using it.
Try skipping the rewritecond , though I've never tried it before . for me , I'd change the page name or add a suffix.