1

I have some code to make www.domain.com/state/statename/folder/index.php?name=name to statename.name.domain.com. These are my codes:

RewriteEngine On

RewriteCond %{REQUEST_URI} !\.(jpe?g|gif|bmp|png|tiff|css|js)$ [NC]

RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)\.(domain\.com)$ [NC] 
RewriteRule !^state/ /state/%1/folder/index.php?name=%2&page=%{REQUEST_URI} [L,NC]

The problem is now I have to use full url to link my css, js and image files. Also, one of the plugins in my code (AjaxLoader) Couldn't use full url to load a page in a div. Relative path such as (path/filepath.ext) does not work.

So, is there anyway to use usual path (path/filepath.ext)?

Thank you very much. Really appreciate your help.

1 Answer 1

1

Can you try this rule:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\.(jpe?g|gif|bmp|png|tiff|css|js)$ [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)\.(domain\.com)$ [NC] 
RewriteRule !^state/ /state/%1/folder/index.php?name=%2&page=%{REQUEST_URI} [L,NC]

If that doesn't work then try base tag like:

<BASE href="http://statename.name.domain.com/">
Sign up to request clarification or add additional context in comments.

12 Comments

Nice to meet you again in here. The first one does the same as the above code. It still need to use http link. The second solution(BASE) works for css,images and js but not for AjaxLoader URL. In firefox developer tools, it shows the request as OPTIONS instead of GET. The response is positive (200 OK)
So if BASE tag worked for css, js, images then bulk of your problem is solved. You just need to proiude full path for AjaxLoader
Also can you tell me full URL what AjaxLoader is requesting?
As the file that Ajaxloader need to request in ON the same folder. So I just put `file.php'. When I put the full url, it returns GET (200 OK) but it doesnt show anything.
When you say same folder does it mean DOCUMENT_ROOT for statename.name.domain.com ?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.