denno020 Posted March 6, 2014 Share Posted March 6, 2014 I've been using htaccess in my web projects for a little while now, both at home and at work. I'm currently working on a website for a friend, which is a wordpress one, and I'm trying to set up my htaccess in the root of my website which will handle old links, and forward people on the the new location (they previously had presta shop, which uses a different link structure). Anyway, I've got my public folder on my host, which has my htaccess, an index.php file, and a wordpress folder, which has all of the wordpress stuff. The plan was to capture links that weren't already going to a wordpress subdirectory, pass them to the index.php file, and then that will work out where the user should be redirected to. Sounds simple enough, but for whatever reason, it's just not working and I can't for the life of me figure out why. The following is my htaccess file: # Use PHP5.4 Single php.ini as default AddHandler application/x-httpd-php54s .php RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^((?!wordpress).)*$ index.php?url=$0 [QSA,L] So as you can see, it's very simple. The first few lines before RewriteEngine are specific for my host. Anyway, this works perfectly on my local server (wamp), however running it on my live server, I continually get "404:File Not Found". The index file is in the exact same location as the htaccess file, so there isn't any problem with that. I've also tried putting junk into my htaccess, to see if it's actually being used, and it is. If I put "some junk" (literally that string) into my htaccess just before the RewriteEngine on directive, I get this message: [an error occurred while processing this directive] So I know my htaccess is being read.. Can anyone see something that I'm missing? Thanks, Denno Quote Link to comment https://forums.phpfreaks.com/topic/286756-am-i-missing-something-simple-with-my-htaccess/ Share on other sites More sharing options...
Solution denno020 Posted March 7, 2014 Author Solution Share Posted March 7, 2014 So I figured out what the problem was, in case anyone was wondering. I had a temporary URL, as I'm moving the website to a different hosting company, and it turns out that when I was reading the http_host in my php file, it was only pulling the ip address in, it wasn't also pulling in the my username which corresponded to my folder on their server. Anyway, that probably doesn't explain it very well, but it's all fixed now, so that's the main thing. Quote Link to comment https://forums.phpfreaks.com/topic/286756-am-i-missing-something-simple-with-my-htaccess/#findComment-1471734 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.