Redirect Page Url to homepage `.htaccess` - wordpress

I'm noob when it comes to .htaccess tricks.
However, I have a page http://example.com/register and when a user enters this URL, I want this page to redirect directly to Homepage or let's say any other page.
I've inserted following code inside .htaccess, but it's not working.
#Redirect to Homepage
Redirect 301 /register http://www.example.com/
Anything I'm missing here?

Check your apache server setting.
Is AllowOverride setted on your root directory.
For example:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
See How to Set AllowOverride all

Related

non www to www not working for wordpress in EC2 instance using safari

If I use my safari browser, I cannot get to my website example.com. I have to use www.example.com for it to work. I tried editing htaccess numerous times and still, it doesn't work.My website is using bitami wordpress image (https://docs.bitnami.com/)which is hosted in AWS.
Bitnami Engineer here:
By default, we disable .htaccess files due to security and performance reasons. We also move .htaccess files content to a file called htaccess.conf in the folder /opt/bitnami/apps/wordpress/conf. You can check more about it at https://docs.bitnami.com/aws/infrastructure/lamp/administration/use-htaccess/.
If you want to enable .htaccess usage, you would need to set it to AllowOverride All in /opt/bitnami/apache2/conf/bitnami/bitnami.conf file:
<VirtualHost _default_:80>
DocumentRoot "/opt/bitnami/apache2/htdocs"
<Directory "/opt/bitnami/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All <---- HERE
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3 >
Require all granted
</IfVersion>
</Directory>
And restart Apache after applying your changes.
For more info, find WordPress documentation below:
https://docs.bitnami.com/aws/apps/wordpress/
Regards

Wordpress shows Index /

When I open my website URL it shows Index /
1) I have index.php in the same directory
2) Config file at /etc/apache2/sites-available/example.com.conf
has following code:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/intricare>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
DirectoryIndex index.php
Order allow,deny
allow from all
</Directory>
If I Refresh the URL again it loads the website without issue.
URL: intricare.net
Your problem is a cache somewhere on your network. When you manually refresh the site, your browser sends an extra header telling the server it desires a fresh copy: cache-control: no-cache.
If that header is sent, the current/correct version of the page is returned. If it is not, the cached directory listing is.
If you have curl installed, you can test it yourself with
curl https://www.intricare.net/
and
curl -H "cache-control:no-cache" https://www.intricare.net/
The latter produces the correct output.
If you're using any caching plugins: make them clear the cache. It might also be your hosting provider that is providing the cache, in that case look at their FAQs or ask them how to clear it.

Wordpress with my site

I have a blog on wordpress, for example www/blog.com - folder
and my site example.com, www/example.com - folder.
I try integrate worpress with my site. example.com/blog - must go to wordpress index page, and example.com/blog/post_name must go to wordpress post.
apache conf
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/example.com
ServerAlias www.example.com
Alias /blog /var/www/blog.com
<Location /blog>
</Location>
</VirtualHost>
<Directory /var/www/example.com>
#code
</Directory>
<Directory /var/www/blog.com>
#code
</Directory>
In worpress admin panel i change:
WordPress Address (URL) to example.com/blog
Site Address (URL) to example.com
Permalink Settings to /blog/%postname%/
When i go to example.com/blog it work fine, but when i type
example.com/blog/post_name i have 404 error.
Edit:
request example.com/blog go to wordpress directory, but example.com/blog/post_name go to example.com index.php
check out this wordpress.org article. it will help you ensure that you have mod_rewrite enabled, along with inserting the AllowOverride FileInfo directive that I can already see you're missing within your VirtualHost. Don't forget to read on about the .htaccess file for your /blog (/var/www/blog.com) directory. You'll want to make sure your RewriteBase is set to /blog

Magento doubled base url in CSS paths

I'm migrating to other server, and in the new server I got this error, the path to all css files are wrong, the js paths are fine, everything else is fine.
Path magento return through getCssJsHtml():
/var/www/domain.com/public/http://domain.com/public/skin/frontend/fortis/default/css/style.css
The path that getSkinUrl() function returns is correct.
Changed the base_url (secure and unsecure) to the new one.
merge_files are 0
cleaned the cache (rm -rf * in var/).
Tried to change ownership of media and var folders to www-data, didn't work as well.
I'm using Fortis theme.
I have GTSpeed extension installed, if I disable it, the head tag shows empty.
If I enable css and js compression in GTSpeed I get a 400 Bad request error.
The admin section always works fine, only thing I noticed is if I change the Link Base Url in Configuration >> Web, I got an 404 error when saving. But I can change all other fields and it saves as expected.
The vhost configuration:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
<Directory "/var/www/domain.com/public">
Options All
AllowOverride All
Order allow, deny
Allow from all
</Directory>
RewriteEngine on
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Check what your secure and unsecure urls have trailing slash: http://domain.com/
The same for skin, js, css paths: {{unsecure_base_url}}skin/
After that check your .htaccess file, especially RewriteEngine and RewriteBase params. In most cases next values working fine:
Options All
RewriteEngine on
RewriteBase /
If you use Apache vhosts, check vhost config. In VirtualHost section you need next lines:
<VirtualHost>
...
<Directory "/var/www/domain.com/public">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
...
</VirtualHost>

Redmine in subfolder. Drupal (in main folder) handles all requests

I have Redmine in subfolder /var/www/redmine and Drupal in folder /var/www/
When I go to URL mysite.com/redmine, Redmine shows ok, but mysite.com/redmine/login is (over)handled by Drupal.
Apache config is as follows
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
RailsBaseURI /zoo-redmine
PassengerResolveSymlinksInDocumentRoot on
Options Indexes FollowSymLinks -MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
It seems a Drupal configuration issue. Try to look in your Drupal configuration panel to exclude from Drupal's login system the /redmine/ subfolder. I can't point you to the exact url because my drupal configuration uses CAS, but it is probably in
Start -> Administration -> Configuration -> People
It was as simple as RewriteRule ^zoo-redmine - [L] before other rewrites in .htaccess
This code exits .htaccess file if encounters zoo-redmine string and don't allow Drupal to readdress this request to index.php with arguments

Resources