Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
1.4k views
in Q2A Core by
Hi,

How can I change all of the links throughout the site so that they do not have the preceeding '.' before the uri?

It is causing my CSS to break when in subdirectories such as domain.com/admin/categories, because the full stop is basically saying, start from the current directory. I just want it to start with the forward slash so it is relative to my domain.

Thanks
by
Is the problem that your CSS file is not being loaded, or that resources referenced within the CSS are not being loaded?
by
edited by
CSS file not being loaded because the link is broken.
I have got around this by adding a relative link in the admin area where you can specify custom <head> code. You can see this if you view source on the pages below.

Still have the problem of the links not being relative whilst that full stop is there though. How can I remove this?

Take a look around my site, http://whatwouldhappenif.co
You can replicate the problem by visiting http://whatwouldhappenif.co/questions/health , and then by clicking any top nav link. The full stop in href means from current directory, leading to broken links.

1 Answer

0 votes
by
 
Best answer

Have you modified anything in the core files? Q2A creates relative URLs with the appropriate number of ../ prefixes to get back to your home directory, but for some reason that doesn't seem to be working on your site. My best guess is that something is interfering with $relativedepth being set correctly in qa-index.php.

by
No not modified anything in the core files.
I have selected the top option in URL Structure - /123/why-do-birds-sing (requires htaccess file) and have written some rewrite rules for IIS (see below).

<rule name="NiceURL1" stopProcessing="true">
  <match url="^([^/]+)$" />
  <action type="Rewrite" url="index.php?qa={R:1}" />
</rule>
               
<rule name="NiceURL2" stopProcessing="true">
  <match url="^([^/]+)/([^/]+)$" />
  <action type="Rewrite" url="index.php?qa={R:1}&amp;qa_1={R:2}" />
</rule>

I will have a look through that file, thanks for the suggestion
by
YEY WORKING! http://whatwouldhappenif.co

I changed line 142 of qa-index.php, so that $qa_root_url_relative equals '/' instead of './' when $relativedepth is not greater than 1.

Thanks for your help! Looking forward to getting my site live soon.
...