I have php files on my local server.
First file is: sanjeev-kapoor.php
Second file is: product-sub.php
What I am trying to achieve through .htaccess file is, when a user hits in URL
http://mywebsite.com/sanjeev-kapoor.html
it should process the page http://mywebsite.com/sanjeev-kapoor.php
And when user hits this url:
http://mywebsite.com/product/sanjeev-kapoor/tea-set.html
It should process and show this page:
http://mywebsite.com/product-sub.php??mid=firstQueryParam&series=secondQueryParam [L]
Here is my htaccess file content:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^/sanjeev-kapoor.html /sanjeev-kapoor.php [L]
RewriteRule ^/?product/(.*)/([^/]+).html /product-sub.php?mid=$1&series=$2 [L]
</IfModule>
But its not working. It always shows me 404 Not found error.
The requested URL /site/product/sanjeev-kapoor/tea-set.html was not found on this server.
I made it sure that "Override all" is there and require all granted is there in my .httpdconf file. Also, the rewrite module is enabled in my config file.
Please help.
Related
I am trying to rewrite URL's using .htaccess methods. This is working on localhost when XAMPP is used, but when I put it on the server it just doesn't.
Here is an example of the code used:
RewriteEngine On
Options +FollowSymLinks
Options -Indexes
DirectorySlash Off
RewriteRule ^contacts?$ contacts.php
RewriteRule ^example?$ tester.php?number=1
RewriteRule ^anotherexample?$ tester.php?number=2
I get this error message:
The requested URL /AMENPTHOME/hostnd/b/5/6/b56a95b8c/www/htdocs/public/new/produto_individual.php was not found on this server.
Can someone help?
I installed wordpress and configured and I wrote a post and publish the post but I get this error:
"The requested URL /myPost/ was not found on this server."
I modify my httpd.conf file and I add:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
and I also add .htaccess in my web root directory:
RewriteEngine on
<IfModule mod_rewrite.c>
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
and restarted apache. But now I'm getting the following error:
Oops! That page can’t be found.
Any of you knows what is wrong or how can I fix this to able to see my post in wordpress?
I'll really appreciate you help.
The issue is caused due to the permalinks now set correctly.
Perform the steps
1) delete the .htaccess file - WP will create it automatically
2) Change the permalink settings
WP site pages and posts works fine
Have been around the houses with this - have read many htaccess issues etc - and still can't seem to get this to work.
I have a WordPress site installed at var/www
I wanted to have a specific URL point to a specific page. Started by browsing some WordPress plugins. None of them worked so I just went straight to the source and started editing the .htaccess file in the root of the WordPress installation. This is where it started getting frustrating.
One of the many attempts at an .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
Redirect 301 /redirect-me http://my-wordpress-site/?page_id=15
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
All attempts at a Redirect have resulted in 404 Not Found errors.
I have asserted the following things:
Apache2 Rewrite Module is enabled
www-data has both read and write access to the .htaccess file.
AllowOverride is set to All in the apache2.conf file for the directory
Here's a big clue for you: swapping the last ReWrite rule within my .htaccess file does absolutely nothing to my WordPress site...
RewriteRule . /poo.php [L]
Any other suggestions for debugging a failing .htaccess file?
When you make configuration changes such as AllowOverride in the config, make sure your do a restart on Apache2 so the changes become effective. Give that a shot.
so I just implemented the YOURLS script successfully, or so I thought.
It generates the shortened URL succesfully and adds it too the YOURLS url ID table, but when I try and navigate to the website, via using the new shortened url. I always get the same error message in the browser.
Not Found
The requested URL /4 was not found on this server.
Apache/2.4.3 (Unix) Server at scof.me Port 80
Most appreciated if you could help!
YOURLS has information on creating the .htaccess file manually on this page.
For a root install, the file has to look like this:
Case: YOURLS installed on root
If YOURLS root URL is http://www.example.com/, the .htaccess file in the root directory must be like:
# BEGIN YOURLS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /yourls-loader.php [L]
</IfModule>
# END YOURLS
I had the same problem on amazon aws ubuntu 12 and solved here:
https://askubuntu.com/questions/48362/how-to-enable-mod-rewrite-in-apache
"If you plan on using mod_rewrite in .htaccess files, you also need to
enable the use of .htaccess files by changing AllowOverride None to
AllowOverride FileInfo. For the default website, edit
/etc/apache2/sites-available/default:"
And yes I plan on using mod_rewrite in .htacess then..
Then you have to restart apache.
I have a friendly URL module redirecting my index page to a search page. If I write index.php with my link then it redirects me to index page. If I try to access registration page it gives me error
ABS_PATH is not loaded. Direct access is not allowed.
If I try to access any category it gives me an error such as
Not Found
The requested URL /for-sale_1/toys-games-hobbies_1/ was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
I have checked my error log it is giving me this error
<IfModule mod_rewrite.c> is without </Ifmodule>
Works great on the local server, but not on the remove live using Apache.
Category links work on the live site but when I click to register or login or publish link it gives the error:
ABS_PATH is not loaded. Direct access is not allowed.
Here is the rule for register that is defined in generate_rules.php
$rewrite->addRule('^user/register$', 'index.php?page=register&action=register');
define('REL_WEB_URL', '/home/xxx/public_html');
define('WEB_PATH', 'xxx.com/';);
You should disable MultiViews option. Write the following line in your .htaccess file (it should be in the root folder of your OSClass installation):
Options -MultiViews
Moreover, you should make sure that the .htaccess file exists.
Try disabling negotiation module of apache or disabled MultiViews directive in server's configuration and/or .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Options -MultiViews
</IfModule>
create .htaccess file , copy root folder working!