简体   繁体   中英

.htaccess 404 redirect not working correctly

I recently transferred my website to another domain. I have the old domain redirecting old links to the splash page. Although because I used wordpress the previous links such as - http://scottramsay.co/services/multi-track-mixing-mastering/ I get a css error.

The redirect works when there is not a second backslash, although when a second the redirect does not read the css file.

Example:

Works correctly - scottramsay.co/services

Does not work - scottramsay.co/services/multi-track-mixing-mastering/

How would I fix this? I'm guessing it's something to do with the .htaccess file.

.htaccess code currently: ErrorDocument 404 /

Thanks.

I think you have a more fundamental issue in the coding. Looking at the pages side by side they both attempt to load CSS & JavaScript from './' which basically means 'this directory.' But it can only be in one place.

<link rel="stylesheet" href="./enter.css" type="text/css">
<meta http-equiv="imagetoolbar" content="no"> 

<script type="text/javascript" src="./jquery.js"></script>
<script type="text/javascript" src="./enter.js"></script>

Without seeing the full .htaccess I would recommend you just create full URLs for those items as shown below. Especially if this is a WordPress site that can set base/root URLs easilly.:

<link rel="stylesheet" href="http://scottramsay.co/enter.css" type="text/css">
<meta http-equiv="imagetoolbar" content="no"> 

<script type="text/javascript" src="http://scottramsay.co/jquery.js"></script>
<script type="text/javascript" src="http://scottramsay.co/enter.js"></script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM