We help IT Professionals succeed at work.

http redirects

doctorbill
doctorbill asked
on
I have an xampp (Apache) server setup such that the Wordpress files are in the following directory:
htdocs/Wordpress

If I use http://localhost/wordpress the site works perfectly well
I need to be able to type in the public website address such that the original request is diverted to the Wordpress/Index.php file rather than typing http://mydomainname.com/wordpress

ie. http://www.mydomainname.com
This should then reference the Wordpress/Index.php file

Please can someone tell me how to achieve this - .htaccess?, redirect ?
I need clear instructions please as I am not familiar with the apache server setup
Comment
Watch Question

David FavorFractional CTO
Distinguished Expert 2019

Commented:
https://www.experts-exchange.com/questions/29137540/How-to-Get-Apache-on-MAMP-Pro-to-only-server-HTTPS.html provides one way to accomplish this, which also handless upgrades to HTTPS also.

Be sure to always use 302s, else you'll always be fighting with browser caching issues...
Most Valuable Expert 2017
Distinguished Expert 2019
Commented:
Have you looked at the Wordpress article that covers this

https://wordpress.org/support/article/giving-wordpress-its-own-directory/

Author

Commented:
I tried this but I get a page not displayed

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?inventas.co.uk$
RewriteCond %{REQUEST_URI} !^/wordpress/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?inventas.co.uk$
RewriteRule ^(/)?$ my_subdir/index.php [L]
</IfModule>
Most Valuable Expert 2017
Distinguished Expert 2019
Commented:
You did not change all instances of my_subdir to wordpress.

Author

Commented:
Aaaahhh
Sorry - missed those
Now all ok

Another cheaky question - how to add an ssl to an apache (xampp) server
Most Valuable Expert 2017
Distinguished Expert 2019

Commented:
Another cheaky question - how to add an ssl to an apache (xampp) server
Best to ask that in a separate question.

Author

Commented:
ok