user762579
user762579

Reputation:

.htaccess not working in Apache EC2 Linux Server

mode rewrite is on (checked with info.php test AllowOveride All in etc/httpd/conf/httpd.conf file

inserted .htaccess in /var/www/html

RewriteEngine On
 RewriteBase /wordpress/
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /wordpress/index.php [L]

( want to redirect from home page to wordpress subdirectory ...)

restarted Apache

service httpd restart

but Apache home page displayed ... on http://mywpblog.net

wordpress home page when request is http://mywpblog.net/wordpress

Did I miss anything ? ( dummy on EC2/httpd ) thanks

Upvotes: 2

Views: 3806

Answers (1)

user762579
user762579

Reputation:

wrong .htaccess ! should be ( in /var/www/html directory )

<IfModule mod_rewrite.c>

# Turn on rewrites.
 RewriteEngine on

# Don't apply to URLs that go to existing files or folders.
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d

# Only apply to URLs that aren't already under /wp.
 RewriteCond %{REQUEST_URI} !^/wordpress/

# Rewrite all those to insert /wordpress
 RewriteRule ^(.*)$ /wordpress/$1

# Redirect the root folder.
 RewriteCond %{HTTP_HOST} ^(www.)?yodojodo.net$
 RewriteRule ^(/)?$ wordpress/ [L]
 </IfModule>

Upvotes: 3

Related Questions